Core Services

RSS for tag

Access and manage key operating system services using Core Services.

Posts under Core Services tag

20 Posts

Post

Replies

Boosts

Views

Activity

Finder shows warning "Apple could not verify file is free of malware" when setting my app as "Always open with"
A user of my AppKit, document-based app brought to my attention that when setting it as the default app to open a certain file with extension .md (by choosing in the Finder "File > Open With > Other", then selecting my app and enabling "Always open with"), trying to open it with a double-click displays the warning "Apple could not verify [file] is free of malware that may harm your mac or compromise your privacy". This is what happens for me: When keeping the default app for a .md file (Xcode in my case), the file opens just fine. When choosing my app in the "File > Open With" menu, the file opens just fine in my app. But when setting my app as the default app (see above), the warning is displayed. From that moment on, choosing my app in the "File > Open With" menu doesn't work anymore. Selecting Xcode doesn't work either. Only setting Xcode again as the default app allows me to open it in Xcode, but my app still isn't allowed to open it. Is this a macOS issue, or can I do anything in my app to prevent it? Where should I start looking for the issue in my code?
14
0
227
Aug ’25
Supported URL Schemes
Some Apple URL schemes are documented for third-party use. It’s fine to use those URL schemes for their intended purpose. Other Apple URL schemes are not officially documented. Their use is unsupported. If you rely on such implementation details, things might work, or they might not, and that state might change over time. IMPORTANT If you ship via the App Store, pay attention to clause 2.5.1 of the App Review Guidelines. The Apple URL scheme documentation is not always easy to find. I’m aware of the following: Apple URL Scheme Reference QA1924 Opening Keyboard Settings from a Keyboard Extension [This Q&A was retired years ago.] Preparing your app to be the default messaging app The doc comments for es_new_client in <EndpointSecurity/ESClient.h> Developer > Bug Reporting describes the applefeedback scheme Additionally, as questions about this most commonly crop up in the context of opening Settings (System Settings on macOS), I wanted to highlight the following: UIApplication.openSettingsURLString property (in Objective-C this is UIApplicationOpenSettingsURLString) UIApplication.openNotificationSettingsURLString property (in Objective-C this is UIApplicationOpenNotificationSettingsURLString) AccessibilitySettings.openSettings(for:) method FIFinderSyncController.showExtensionManagementInterface() class method SMAppService.openSystemSettingsLoginItems() class method VSOpenTVProviderSettingsURLString global CXCallDirectoryManager.openSettings(completionHandler:) method If your app needs to perform some action that’s not covered by the above, file an enhancement request for a supported way to do that. Make sure to describes your use case in detail. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Revision History 2025-04-21 Added a link to CXCallDirectoryManager.openSettings(completionHandler:). 2024-10-25 Added a link to UIApplication.openNotificationSettingsURLString and VSOpenTVProviderSettingsURLString. Added a link to Preparing your app to be the default messaging app. 2024-10-01 Added info about the applefeedback URL scheme. 2024-09-29 Added a link to SMAppService.openSystemSettingsLoginItems(). 2024-09-27 Added a titbit for Finder Sync extension developers. Added an invitation to file feedback. 2024-08-05 First posted.
0
0
1.8k
Apr ’25
Handle double click on a file associated with my application
When my application starts up I want to check if the application starts because of double click in Finder, or open file in Finder. If the file is opened from Finder I will not show Welcome screen and open directly the file. But if there is no such file it will show Welcome screen. I can register for kAEOpenDocuments but I had to wait for the event to be triggered and how long should I wait. What would be the proper way to handle this
1
0
56
Apr ’25
Calling from Watchos
I am working with a watchOS app in SwiftUI, and I am using the following code to dial a phone number from the watch: var number = "123456789" if let telURL = URL(string: "tel:\(number)") { let wkExtension = WKExtension.shared() wkExtension.openSystemURL(telURL) } The issue is that when I try to dial a number starting with a * (asterisk) or # (hash), it doesn't work. When dialing a regular number, it works fine. Is there any way to get this to work?
1
0
87
Apr ’25
Unexpected Termination on macOS under Low Disk Space (CacheDeleteAppContainerCaches)
We’re receiving increasing user reports that our macOS app is unexpectedly terminated in the background—without crash reports or user action. Our app is a sandboxed status-bar app (UIElement, NSStatusItem) running continuously, syncing data via CloudKit and Core Data. It has no main window unless opened via the status bar. Observed patterns: Happens more frequent on macOS 15 (Sonoma), though earlier versions are affected too. Often occurs when disk space is limited (~10% free), but occasionally happens with ample free space. System logs consistently show: CacheDeleteAppContainerCaches requesting termination assertion for &lt;our bundle ID&gt; No crash reports are generated, indicating macOS silently terminates our app, likely related to RunningBoard or CacheDelete purging caches during disk pressure. Since our app is meant to run persistently, these silent terminations significantly disrupt user experience. We’re seeking guidance on: Can we prevent or reduce these terminations for persistently running status bar apps? Are there recommended APIs or configurations (e.g., NSProcessInfo assertions, entitlements, LaunchAgents) to resist termination or receive notifications under low disk conditions? What are Apple’s best practices for ensuring sandboxed apps reliably run during disk pressure? We understand macOS terminates apps to reclaim space but would appreciate recommendations to improve resilience within platform guidelines. Thank you!
2
0
84
Apr ’25
Defining custom file types
On iOS:When one receives a file of type .pages by email, Mail displays a large Pages icon and tapping on it opens Pages. (A long-press brings up the more complicated Actions screen).When one receives a file of type .vcf by email, Mail displays a large Contacts icon and tapping on it opens Contacts. (A long-press brings up the more complicated Actions screen).I have my own custom file type, .ripf, and I want to have the same behaviour because that is what my users will expect. Accordingly, in my app's Info.plist I have a CFBundleDocumentTypes dictionary providing a one-element LSItemContentTypes array referring to the name 'com.universalis.ripcard', and a UTExportedTypeDeclarations dictionary associating the UTTypeIdentifier 'com.universalis.ripcard' with a public.filename-extension 'ripf' and a public.mime-type 'text/vnd.universalis.ripcard'. All the other entries in those two dictionaries are present and correct as far as I can tell. Both CFBundleDocumentTypes[0].CFBundleTypeIconFiles and UTExportedTypeDeclarations[0].UTTypeIconFiles contain a list of icon files for the file type.(That rather long paragraph is to avoid boring people by including the entire Info.plist!)Some things do work..ripf files received via AirDrop bring up a suitable "Open with..." message which mentions my app, and tapping the message opens the app..ripf files received as an email attachment display as an icon. But it is the app's icon and not the icon of the file type.BUTTapping on a received file's icon does not open the app, but only opens the generic Actions screen, offering Message, Mail, WhatsApp, Notes, and only then (after the user has scrolled sideways) "Copy to..." my app.Now, the whole apparatus of CFBundleDocumentTypes and UTExportedTypeDeclarations is obscure and under-documented, and indeed the main documenation for the latter has a big warning at the top saying that it is obsolete and not being updated. That doesn't matter so much. What I need to know is:(Less important): How do I get the right file icon?(More important): How do I get my app to open when the icon is tapped, as Pages and Contacts do? There must be a way – unless special cases for those two apps are wired into iOS itself.
10
0
6.4k
Apr ’25
Can't open p12 file inside my application
I need to open p12 file from other iOS applications to import private key to my application. My app is set up to be able to open nay file with following plist &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;Files&lt;/string&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Default&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.item&lt;/string&gt; &lt;string&gt;public.data&lt;/string&gt; &lt;string&gt;public.content&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; But my don't appear in share dialog from Files or Mail app for example. There are however other third party apps that can accept this file. Some of them use Share extension which I don't have, but some of them don't have it as far as I can understand. At least they don't present any UI and open apps directly. Also I've tried to specify com.rsa.pkcs-12 UTI directly but it didn't help. Also noticed that *.crt files have similar behaviour. Am I missing something about this specific file type?
1
0
67
Apr ’25
The issue of unable to use document type for Mac catalyst project
Hello, I have encountered a question that I hope to receive an answer to. Currently, I am working on a music project for Mac Catalyst and need to enable music files such as FLAC to be opened by right clicking to view my Mac Catalyst app. But currently, I have encountered a problem where I can see my app option in the right-click open mode after debugging the newly created macOS project using the following configuration. But when I created an iOS project and converted it to a Mac Catalyst app, and then modified the info.plist with the same configuration, I couldn't see my app in the open mode after debugging. May I ask how to solve this problem? Do I need to configure any permissions or features in the Mac Catalyst project? I have been searching for a long time but have not found a solution regarding it. Please resolve it, thank you. Here is the configuration of my macOS project: CFBundleDocumentTypes CFBundleTypeExtensions flac CFBundleTypeIconSystemGenerated 1 CFBundleTypeName FLAC Audio File CFBundleTypeRole Viewer LSHandlerRank Default Note: Sandbox permissions have been enabled for both the macOS project and the iOS to Mac Catalyst project. The Mac Catalyst project also has additional permissions for com. apple. security. files. user taught. read write
0
0
56
Mar ’25
How to configure my app to be the default email client app
I followed the instruction on Preparing your app to be the default browser or email client. I have acquired the permission from Apple. The entitlement is included in the provisioning profile. mailto is specified in URL Schemes. But I downloaded my app from TestFlight and enter Setting &gt; MyApp, the switch that could enable my app to be the default email app was not there. I have no clue what I did it wrong. Does anyone know how to configure the app properly?
2
0
1.1k
Mar ’25
LSRegisterURL resultCode -10819
I have an option in my app to set the URL Handler for smb or switch it back to Finder. But using my code below it always give me a -10819 error. Which is a generic kLSNotRegisteredErr, even those the documentation shows "Not currently used." func setDefaultHandler(bundleID: String) { DebugLogger.shared.log("Attempting to set \(bundleID) as default handler for SMB URLs") // Post Sonoma macOS requires user interaction to change default handlers // We'll register our app and then guide the user to System Settings // For our app, register it with Launch Services if bundleID != "com.apple.finder" { if let appBundleURL = Bundle.main.bundleURL as CFURL? { let registerResult = LSRegisterURL(appBundleURL, true) DebugLogger.shared.log("LSRegisterURL result: [\(appBundleURL)]\(registerResult)") } } // Check current handler using modern API let testSMBURL = URL(string: "smb://example.com")! if let handlerURL = NSWorkspace.shared.urlForApplication(toOpen: testSMBURL) { DebugLogger.shared.log("Current default handler is: \(handlerURL)") // Try to get the bundle ID from the URL var currentHandlerBundleID = "" if let bundle = Bundle(url: handlerURL) { if let handlerBundleID = bundle.bundleIdentifier { currentHandlerBundleID = handlerBundleID DebugLogger.shared.log("Current default handler bundle ID: \(handlerBundleID)") } } // Check if the current handler is already what we want let alreadySet = currentHandlerBundleID == bundleID DebugLogger.shared.log("Handler is already set correctly: \(alreadySet)") if alreadySet { let alert = NSAlert() alert.messageText = "Default Handler Status" alert.informativeText = "\(bundleID == "com.apple.finder" ? "Finder" : "LGN") is already set as the default handler for SMB URLs." alert.addButton(withTitle: "OK") alert.runModal() } else { // Guide the user to System Settings to change the handler promptToSetDefaultHandler(bundleID == "com.apple.finder" ? "Finder" : "LGN") } } else { DebugLogger.shared.log("Could not determine current handler") promptToSetDefaultHandler(bundleID == "com.apple.finder" ? "Finder" : "LGN") } }
4
0
330
Mar ’25
Deeplink between two standalone watchos App
I have two standalone app written for watchos (standalone). One to authenticate and one for connectivity to real-world devices. The connectivity app uses the authentication app before every action, Im testing this with two xcode projects I have created and tried different things ended up with this error. authapp://authenticate?callback=linkingapp://callback -[SPApplicationDelegate extensionConnection:openSystemURL:]:2418: URL with scheme "authapp" not supported how to get the url scheme working? Tested this in simulator and real device. info.plist and AppDelegate files are placed in both apps.
1
0
1.1k
Feb ’25
iOS Settings URL for SOFTWARE_UPDATE_LINK Not Working on iOS 18
Hello, I have been using the App-prefs:General&amp;path=SOFTWARE_UPDATE_LINK URL in my application to navigate to system settings, and it worked as expected. However, after updating to iOS 18, it no longer works, and I haven't been able to find a replacement. Is there any alternative solution or a different URL that works? I also tried prefs:root=General&amp;path=SOFTWARE_UPDATE_LINK, but it didn’t work either.
1
0
406
Feb ’25
Troubles with CFBundleDocumentTypes and photos
I'm working on adding CFBundleDocumentTypes to my Info.plist so that a user can share an image from other apps on their device and have it open inside my iPhone app. I seem to be able to get this to work for sharing a single photo from the Photos app, but not for (1) multiple photos from the Photos app or (2) images from Safari. One thing that makes this difficult is that my changes to Info.plist sometimes have no effect. I can remove CFBundleDocumentTypes and still see the icon, for example. Or I can add a new accepted UTI, but it has no effect. I've tried cleaning and rebuilding, deleting and reinstalling the app...no success. I tried in the simulator, too, and even Erase Content and Settings didn't force changes to be applied. I'm not sure what else to try here. Anyway, I'd like my app to appear in the Share sheet for photo(s) from the Photos app, Mail and Safari, in particular, but really from any app that supports sharing photos. I can share the config that seemed to work, but since changing it doesn't always have an effect, I can't guarantee that this was the one that worked. At the moment, it doesn't work, but I'm not sure why. Here it is: &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt; &lt;array/&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;Image&lt;/string&gt; &lt;key&gt;CFBundleTypeRole&lt;/key&gt; &lt;string&gt;Viewer&lt;/string&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Alternate&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.data&lt;/string&gt; &lt;string&gt;public.jpeg&lt;/string&gt; &lt;string&gt;public.png&lt;/string&gt; &lt;string&gt;public.image&lt;/string&gt; &lt;string&gt;public.gif&lt;/string&gt; &lt;string&gt;public.url&lt;/string&gt; &lt;string&gt;public.content&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; &lt;key&gt;LSSupportsOpeningDocumentsInPlace&lt;/key&gt; &lt;true/&gt; In my code, I also defined the following method in my SceneDelegate (though I think the problem is just with Info.plist): func scene(_ scene: UIScene, openURLContexts URLContexts: Set&lt;UIOpenURLContext&gt;) { Here are my questions: How do I make sure that my changes to Info.plist apply? Is there a cache somewhere that I have to force to clear? This is the trickiest part of this, because I can't reliably try an experiment and see if it worked. Adding the specific image UTI’s (public.jpeg, public.png) seemed to help, even though those types should conform to public.image, which conforms to public.data and public.content. Is it actually necessary to specify those? If the user selects multiple photos in the Photos app, my app doesn’t appear, but other third-party apps on my phone do. How can I support multiple photos? This configuration doesn't reliably show my app for Safari images - what do I need to do to make that happen? I had to use “public.data” when I briefly had Safari sharing working, but there doesn't seem to be a way to get a UTI from UIOpenURLContext. Right now, my code just tries to load the data as an image and aborts if UIImage(data:) returns nil. Is this a safe way of doing this? Is there a way to get the UTI for the data?
2
0
656
Jan ’25
Issue with Missing Private Key After Adding Push Notification Certificate to Keychain
Hi All, I have created a Push Notification certificate from my Apple Developer account. After downloading the aps.cer file and adding it to my Keychain, the certificate was added successfully, but the private key is missing. Has anyone encountered a similar issue in the past? What could be causing this problem?
0
0
391
Dec ’24
Can we disable KeepAlive temporarily for launchctl?
I have a process [command line cpp application] which i want to run always such as it should relaunch after a crash, after device startup etc. I created a launchd Property List File with KeepAlive true and placed under /Library/LaunchDaemons. Problem Statements: I have a bash script to start and stop this process. start using: launchctl bootstrap. stop involve these two steps: send SIGTERM signal and wait untill process stops after doing some cleanups launchctl bootout [It doesn't sends SIGTERM] during steps 1 - Process is getting stop, but also getting immediate relaunch by launchctl during step 2 - it getting stop again. is there a proper way so that we can disable KeepAlive temporarily so that process will not launch during step 1? or suggest other ways to handle this?
3
0
766
Nov ’24
Problems with macOS apps launching since Sequoia 15.1 (spawn constraints failure)
What Starting from macOS Sequoia 15.1, a terminal app (KiTTY) installed via Nix fails to launch apparently due to new hardening mechanism in CoreServices introduced in 24B83 Seems this is triggered not every time. If I create new volume and copy the same path with KiTTY on it, it worked on the first occasion but I failed to make it work reproducibly. @Eskimo I would kindly appreciate if you could highlight more about Secure Launch and related spawn constraints. Anyway, this is blocker issue for me so I'm rolling back to 15.0.1 ❯ open /nix/var/nix/profiles/default/Applications/kitty.app _LSOpenURLsWithCompletionHandler() failed with error -54. Logs ❯ log stream | grep kitty ... 2024-10-30 09:38:56.005739+0100 0x9383 Error 0x45fac 584 0 CoreServicesUIAgent: (LaunchServices) [com.apple.launchservices:open] LAUNCH: Launch requires secure launch with spawn constraints, but none are present or valid, so returning permErr for <FSNode 0x600001e656c0> { isDir = ?, path = '/nix/store/wiindrplkcj1mn22x6nbl8clpnz7adpm-kitty-0.36.4/Applications/kitty.app' } 2024-10-30 09:38:56.005837+0100 0x9383 Error 0x45fac 584 0 CoreServicesUIAgent: (LaunchServices) [com.apple.launchservices:open] LAUNCH: Launch failure with -54/permErr <FSNode 0x600001e778e0> { isDir = y, path = '/nix/store/wiindrplkcj1mn22x6nbl8clpnz7adpm-kitty-0.36.4/Applications/kitty.app' } 2024-10-30 09:38:56.006106+0100 0x9383 Default 0x45fac 584 0 CoreServicesUIAgent: (libxpc.dylib) [com.apple.xpc:connection] [0x600002148d20] activating connection: mach=true listener=false peer=false name=com.apple.coreservices.quarantine-resolver 2024-10-30 09:38:56.006440+0100 0x9383 Error 0x45fac 584 0 CoreServicesUIAgent: (LaunchServices) [com.apple.launchservices:default] LAUNCH: Launch failed in CSUI with error Error Domain=NSOSStatusErrorDomain Code=-54 "permErr: permissions error (on file open)" UserInfo={_LSLine=4224, _LSFunction=_LSOpenStuffCallLocal} 2024-10-30 09:38:56.007039+0100 0x9381 Default 0x45fac 584 0 CoreServicesUIAgent: (libxpc.dylib) [com.apple.xpc:connection] [0x14f00fca0] activating connection: mach=false listener=false peer=true name=com.apple.coreservices.quarantine-resolver.peer[584].0x14f00fca0 2024-10-30 09:38:56.007602+0100 0x9381 Error 0x45fac 584 0 CoreServicesUIAgent: [com.apple.launchservices:uiagent] handle LS launch error: status=-54 {\n Action = odoc;\n AppPath = "/nix/store/wiindrplkcj1mn22x6nbl8clpnz7adpm-kitty-0.36.4/Applications/kitty.app";\n Documents = (\n "kitty.app"\n );\n ErrorCode = "-54";\n FullPaths = (\n "/nix/store/h33cy9y53p6dnyzx41a1dfxsr0df8i4c-system/Applications/kitty.app"\n );\n} Environment ❯ uname -a Darwin airstation.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64 ~ ❯ sw_vers ProductName: macOS ProductVersion: 15.1 BuildVersion: 24B83 ❯ arch arm64
2
5
1.1k
Oct ’24