Skip to main content

Posts

Showing posts with the label macOS

macOS Menu Bar Apps: SwiftUI Popovers and WindowManagement APIs

  Building a "Status Bar Only" application (agent app) on macOS seems deceptively simple: set a flag in   Info.plist , use a   MenuBarExtra , and you are done. However, as soon as you attempt to add complex interactivity—text inputs, intricate state management, or custom window sizing—the abstraction leaks. You encounter the classic "Agent App" lifecycle problems: The popover doesn't automatically close when clicking the desktop. Text fields refuse to accept focus because the app never officially "activates." MenuBarExtra  in  .window  style lacks fine-grained control over positioning relative to the screen edge. To build a production-grade utility that feels like native macOS Control Center modules, we must bypass the  MenuBarExtra  wrapper and orchestrate  NSStatusItem ,  NSPopover , and the  NSApplication  activation policy manually. The Root Cause: Application Activation Policy The core issue lies in how macOS treats applic...

Debugging macOS Notarization: Solving 'Invalid Signature' in Electron Builds

  The "It Works on My Machine" Trap You have a green build pipeline. The application runs locally. You’ve successfully uploaded your artifact to the Apple Notary Service, and  xcrun notarytool  returns  status: Accepted . Yet, when you download the DMG and attempt to launch it on a fresh macOS instance, Gatekeeper intervenes:  "App is damaged and can't be opened." Running a manual assessment usually yields the dreaded, ambiguous failure: spctl --assess --type execute --verbose --ignore-cache /Applications/MyApp.app # Output: /Applications/MyApp.app: rejected # source=Unnotarized Developer ID Or worse, deep in the system logs, you find  errSecInternalComponent  or  Missing Secure Timestamp . This is rarely a code issue; it is a DevOps architecture issue involving the Mach-O binary structure, nested code signing, and the Hardened Runtime requirements introduced by macOS Catalina and strictly enforced in Sonoma and Sequoia. Root Cause: The Timestamp ...