Hello @eskimo,
When using the amfi_get_out_of_my_way bootarg to enable an Endpoint Security system extension loading, on macOS Sonoma 14.2 (all betas so far), there seems to be a bug introduced where task_set_exception_ports and related APIs fail with GUARD_TYPE_MACH_PORT:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_GUARD (SIGKILL)
Exception Codes: GUARD_TYPE_MACH_PORT
Exception Codes: 0x00000000000048e0, 0x0000000000000000
Termination Reason: Namespace GUARD, Code 2305843035510950112
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x18c8e0854 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x18c8f2cd0 mach_msg2_internal + 80
2 libsystem_kernel.dylib 0x18c90ac78 task_swap_exception_ports + 368
This affects a lot of third-party software, such as 1Password, Firefox, Tower, etc. In the past, another boot arg was needed to prevent crashes: ipc_control_port_options. Is there anything new introduced in Sonoma 14.2 in this regard?
Thank you in advance
Post
Replies
Boosts
Views
Activity
Now broken in macOS 14.3 beta 1.
The solution is very simple: stop using SwiftUI, which is a broken mess, and instead use UIKit, where all this Just Works®.
Still broken in 14.4.1. Quality software by Apple. Top notch.
For images, use the requestImageDataAndOrientation(for:options:resultHandler:) method to obtain a photo’s data, which contains the HDR information. Then you can use CGImageSource, UIImageReader with prefersHighDynamicRange, CIImage, etc. to obtain a UIImage that will correctly display on HDR screens.
For live photos, it’s more complicated. The PHLivePhoto object obtained from requestLivePhoto(for:targetSize:contentMode:options:resultHandler:) does not contain an HDR image. You can use requestImageDataAndOrientation(for:options:resultHandler:) to obtain the HDR version of the image, as above, but displaying it in a PHLivePhotoView is not as simple. There is private API you can use, which I’ll post below, but it’s up to you to decide if that’s risky for you. All private API can be hidden, if the only thing you fear is App Store submission.
fileprivate static func fudgeLiveView(_ liveView: PHLivePhotoView, with image: UIImage?) {
if let image {
liveView.setValue(image, forKeyPath: "playerView.overrideImage")
}
guard let view = liveView.value(forKeyPath: "playerView.subviews.@firstObject") as? UIView else {
return
}
for subview in view.subviews {
if let imageView = subview as? UIImageView {
imageView.preferredImageDynamicRange = .high
}
}
}
Have you, by any chance, added amfi_get_out_of_my_way=1 to your boot-args? It is known to interfere with the TCC permission system, and the OS stops displaying the permission dialogs to users. You can remove the amfi_get_out_of_my_way argument, reboot, run your app once so the OS displays the alert and you accept, and you can add the amfi_get_out_of_my_way=1 argument back.
I now see that PHImageRequestOptions has the following private properties, which you can use to obtain and fine-tune HDR images using all image loading APIs:
@property (nonatomic) BOOL includeHDRGainMap;
@property (nonatomic) BOOL includeHDRGainMapInIntermediateImage;
@property (nonatomic) BOOL preferHDR;
@property (nonatomic) double targetHDRHeadroom;
For posterity, the issue still exists in iOS 17, and it’s by Apple’s assumption that a split view controller is always a window’s root view controller. You can workaround this by overriding the trait collection of the split view controller when the parent tab bar controller’s collection changes:
override func willTransition(to newCollection: UITraitCollection, with coordinator: any UIViewControllerTransitionCoordinator) {
super.willTransition(to: newCollection, with: coordinator)
coordinator.animate { _ in
if let split = viewControllers?.first as? SplitViewController {
setOverrideTraitCollection(newCollection, forChild: split)
}
}
}
The joke that is Apple development tooling, Apple quality assurance, and Apple in general. How embarrassing for the richest company in the world.
It’s UIActivityViewController with private API:
https://developer.limneos.net/index.php?ios=17.1&framework=SafariServices.framework&header=UIActivityViewControllerObjectManipulationDelegate.h
@protocol UIActivityViewControllerObjectManipulationDelegate <NSObject>
@optional
-(BOOL)_customizationAvailableForActivityViewController:(id)arg1;
-(id)customActionViewControllerForActivityViewController:(id)arg1;
-(id)customLocalizedActionTitleForActivityViewController:(id)arg1;
@required
-(id)_customizationGroupsForActivityViewController:(id)arg1;
@end