Context
The event handler of an xpc_connection_t object named myConnection is set and handles XPC_TYPE_ERROR objects:
xpc_connection_set_event_handler(myConnection, ^(xpc_object_t object) {
});
A message is sent using:
xpc_connection_send_message_with_reply(myConnection, myMessage , myQueue, ^(xpc_object_t object) {
});
The documentation for the well-known XPC_ERROR_ dictionaries and for xpc_connection_set_event_handler seems to suggest that all the errors received via the reply block will also be received by the event handler.
Question
Are there error cases where only the reply block of xpc_connection_send_message_with_reply will receive an XPC_ERROR*_ object?
Post
Replies
Boosts
Views
Activity
It looks like that the UX for embedded LaunchDaemons is a "bit" broken in macOS 13.1 (at least). And the UX of the Login Items pane is also quite broken.
I have a simple app bundle with one launch agent and one launch daemon (both embedded).
If I try to register the launch agent, it works. If I try to unregister it, it works,
If i try to register the launch daemon, I can allow it using the system notification.
if I try to register the launch daemon and close the system notification, I can't find a way to allow it in the Settings > General > Login Items pane. If I try to register it again, I don't get a system notification to allow it.
if I try to register the launch daemon and close the system notification and I then try to register the launch agent, it fails and requires approval, which I can't grant because the system notification is AWOL.
if I disable the entry in the Login Items pane for the app, usually, I see disabled items being added for the launch agent and launch daemon while the application is removed from the list.
when I delete the app on Disk, the entries sometimes stay in the Login Items pane, sometimes disappear. Sometimes, quitting Setting.app and opening it again solves the issue, sometimes it doesn't.
if I try to click on the (i) button for either the Launch Agent or Launch Daemon entry, it does not show them in the Finder whereas the app is still there. The (i) button works correctly for an item in ~/Library/LaunchAgents.
Basically, the whole UX seems broken and is totally confusing for both the end user and the developer.
[Q] Is this how this is expected to work?
I'm trying to create a very simple project where an application contains a helper application and the helper application is defined as a LaunchAgent by the main application.
So far, when I call agentServiceWithPlistName:, and then request the status, I get the value 3 (i.e.SMAppServiceStatusNotFound).
I checked that the main .app bundle did not have obvious issues:
there is definitely a .plist in Contents/Library/LaunchAgents.
the .plist definitely defines the BundleProgram value.
there is definitely a .app helper application and the relative path pointed by the BundleProgram key looks definitely correct.
[Q] Are there some useful logs provided by the SMAppService APIs/framework that can provide an idea why a service is not found?
I haven't seen any so far in Console.app.
I have not seen so far a hint in the documentation that would suggest that this SMAppService mechanism requires an app to be notarized or codesigned with a level above (Run locally).
Extra Question: Is there an official example for these new APIs?
While checking the "Updating helper executables from earlier versions of macOS" (Ref. https://developer.apple.com/documentation/servicemanagement/updating_helper_executables_from_earlier_versions_of_macos), the first recommendation is to:
Install the helper executable within the app bundle, such as in Contents/Resources.
This is a bit surprising considering that, AFAIK, "Contents/Resources" has always been considered a bad location for executables.
[Q] Is this an error in the documentation or is putting the helper executables in the Contents/MacOS directory not recommended anymore?
I have a macOS Cocoa application that does not behave correctly when it's launched:
when the application is run from Xcode, it launches fine.
when the same .app application bundle is double-clicked in the Finder, the app does not finish launching and keeps bouncing in the Dock.
same issue when the app is added to the Dock and its icon in the Dock is clicked.
when the executable in Contents/MacOS is run from the Terminal, it launches fine.
when using open application.app from the Terminal, it works fine.
When it does not work, there are multiple log errors in Console.app:
error 16:03:03.882942+0200 launchservicesd LAUNCH: Failed sending SIGCONT to process 0x0-0x72072 16968 com.company.application, errno=1 so waiting a bit and trying again.
If I disable the hardened runtime option, the application can be opened fine from the Finder or the Dock.
The .app is codesigned with the timestamp option.
Same problem with either a debug or release build.
I checked the different documentation regarding hardened runtime conflict or incorrect build settings and I didn't see a match for this case.
[Q] Is there some documentation or article on the Apple website that I missed that covers this LAUNCH: Failed sending SIGCONT error and its possible origin?
It does not seem to be documented but, according to the DiskArbitration source code from Darwin, if an approval callback does not return after 10 seconds, the session state is set to timeout and further approval callbacks are never called anymore.
Based on the source code, it does not seem possible but as I may be missing something:
[Q] Is there a way to get/set the state of a DASessionRef or DAApprovalSessionRef? Would there be some kind of notification mechanism to be informed that a session has been set as timed out?
[Q] If the Active Directory a Mac is bound to changes, will there be a kNotifyDSCacheInvalidation* notification posted?
e.g.
The Mac starts, there are no Network Account Server set up.
An admin user sets up an Active Directory Domain Controller as a Network Account Server.
=> kNotifyDSCacheInvalidation posted?
or
An Active Directory Domain Controller was set up as a Network Account Server.
Another Active Directory Domain Controller is set up instead.
=> kNotifyDSCacheInvalidation posted?
Ref. https://opensource.apple.com/source/Libnotify/Libnotify-80/notify_keys.h
Is there a way to define a NSDictionary * var or property so that only contravariant of a class are accepted for the key?
i.e. something that would look like this:
NSDictionary<__contravariant MYSubclass, id> *dictionary;
?
Just out of curiosity, is this a leftover in Big Sur and Monterey?
/System/Applications/Utilities/Disk\ Utility.app/Contents/Resources/WhereIsMySaveController.txt
[Q] Are there some known cases where a Network Extension would be listed twice in the Network Preferences pane (and each one is active)?
systemextensionctl list only reports one network extension. So it's not a case where there would be 2 different versions of the same extension or with a different bundle identifier or an update having gone wrong.
there is only one instance of the network extension running visible according to ps/top.
the network extension has been allowed using a mobile profile (can the profileSource value of the payloadInfo have an effect?)
The NEConfigurationManager shared manager only reports one instance of a NEConfiguration for the network extension.
[Q] Are there any known common reasons/patterns why libdispatch would face unexpected events?
Application Specific Information:
BUG IN LIBDISPATCH: Unexpected event
...
0 _dispatch_mach_reply_merge_evt + 29
1 _dispatch_kq_drain + 166
2 _dispatch_event_loop_drain + 312
3 _dispatch_lane_serial_drain + 803
4 _dispatch_lane_invoke + 366
5 _dispatch_workloop_worker_thread + 811
6 _pthread_wqthread + 314
7 start_wqthread + 15
There’s also a bit of a mystery with this backtrace as the libdispatch source code (from https://opensource.apple.com/releases) does not list _dispatch_mach_reply_merge_evt (or dux_merge_evt) as being called by _dispatch_kq_drain.
[Q] What is the thread safety status of the IOBluetooth framework?
Is it possible call any class from the IOBluetooth framework from a secondary thread?
I haven't found so far information about this in the documentation and the only pieces of info you can find through a google search say the framework is not thread safe but these are old pieces of info.