Post

Replies

Boosts

Views

Activity

Reply to Display HDR images for PhotoKit assets
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 } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’24
Reply to ES sample project
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
Topic: Privacy & Security SubTopic: General Tags:
Nov ’23
Reply to Display HDR images for PhotoKit assets
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 } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’24
Reply to ES sample project
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
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’23