Post

Replies

Boosts

Views

Activity

Crash and unrecognized mp4, jpeg filetypes on iOS 15.4 simulator devices running on M1 Mac?
I stumbled upon a really peculiar issue while running my application that features both a functionality to create image and video attachments from the user's photos and videos using the PHPicker* API and previewing said attachments using the QuickLook API: Whenever I tap to open a photo (e.g. a JPEG) or a video (e.g. a MP4) using the QuickLook API, on an iPhone 13 15.4 simulator device on Xcode 13.3 on a M1 Macbook Pro host machine, I get a crash with the following call stack: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]' terminating with uncaught exception of type NSException *** First throw call stack: ( 0 CoreFoundation 0x000000011003bd44 __exceptionPreprocess + 242 1 libobjc.A.dylib 0x000000010cd1ea65 objc_exception_throw + 48 2 CoreFoundation 0x00000001100bcf47 _CFThrowFormattedException + 200 3 CoreFoundation 0x00000001100c7417 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5 + 0 4 CoreFoundation 0x00000001100aa827 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 243 5 CoreFoundation 0x000000011003a998 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49 6 QuickLook 0x0000000110f37636 __49+[QLItem(PreviewInfo) contentTypesToPreviewTypes]_block_invoke + 484 7 libdispatch.dylib 0x000000011b0f5a5b _dispatch_client_callout + 8 8 libdispatch.dylib 0x000000011b0f6f24 _dispatch_once_callout + 66 9 QuickLook 0x0000000110f37450 +[QLItem(PreviewInfo) contentTypesToPreviewTypes] + 46 10 QuickLook 0x0000000110f37d91 -[QLItem(PreviewInfo) _uncachedPreviewItemTypeForContentType:] + 117 11 QuickLook 0x0000000110f382fe -[QLItem(PreviewInfo) _previewItemTypeForType:] + 150 12 QuickLook 0x0000000110f38104 -[QLItem(PreviewInfo) _getPreviewItemType] + 61 13 QuickLook 0x0000000110fbf4d2 -[QLItem previewItemType] + 59 14 QuickLook 0x0000000110f6ed15 +[QLItemFetcherFactory fetcherForPreviewItem:] + 90 15 QuickLook 0x0000000110fbeb9b -[QLItem fetcher] + 44 16 QuickLook 0x0000000110f22880 -[QLPreviewController previewItemAtIndex:withCompletionHandler:] + 153 17 QuickLook 0x0000000110f587a8 __63-[QLPreviewItemStore previewItemAtIndex:withCompletionHandler:]_block_invoke + 262 18 QuickLook 0x0000000110f8c621 QLRunInMainThread + 51 19 QuickLook 0x0000000110f58673 -[QLPreviewItemStore previewItemAtIndex:withCompletionHandler:] + 181 20 QuickLook 0x0000000110f1c89f -[QLPreviewController internalCurrentPreviewItem] + 222 21 QuickLook 0x0000000110f9c140 -[QLPreviewController(Overlay) _actionButton] + 344 22 QuickLook 0x0000000110f9c81c -[QLPreviewController(Overlay) _toolBarButtonsWithTraitCollection:] + 1147 23 QuickLook 0x0000000110f9a2ff -[QLPreviewController(Overlay) _updateOverlayButtonsIfNeededWithTraitCollection:animated:updatedToolbarButtons:] + 129 24 QuickLook 0x0000000110f999a2 -[QLPreviewController(Overlay) updateOverlayAnimated:animatedButtons:forceRefresh:withTraitCollection:] + 152 25 QuickLook 0x0000000110f1c707 -[QLPreviewController _setCurrentPreviewItemIndex:updatePreview:animated:] + 230 26 QuickLook 0x0000000110f22416 -[QLPreviewController reloadData] + 418 27 <MYAPP> 0x0000000102a03293 __53-[MyPreviewController downloadAttachment]_block_invoke_2 + 611 28 libdispatch.dylib 0x000000011b0f4816 _dispatch_call_block_and_release + 12 29 libdispatch.dylib 0x000000011b0f5a5b _dispatch_client_callout + 8 30 libdispatch.dylib 0x000000011b104325 _dispatch_main_queue_drain + 1169 31 libdispatch.dylib 0x000000011b103e86 _dispatch_main_queue_callback_4CF + 31 32 CoreFoundation 0x000000010ffa8261 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 33 CoreFoundation 0x000000010ffa2a56 __CFRunLoopRun + 2761 34 CoreFoundation 0x000000010ffa1a90 CFRunLoopRunSpecific + 562 35 GraphicsServices 0x00000001209c8c8e GSEventRunModal + 139 36 UIKitCore 0x000000013499c90e -[UIApplication _run] + 928 37 UIKitCore 0x00000001349a1569 UIApplicationMain + 101 38 <MYAPP> 0x0000000102970669 main + 233 39 dyld 0x000000010c6c4f21 start_sim + 10 40 ??? 0x00000002041ad51e 0x0 + 8658801950 41 ??? 0x0000000000000003 0x0 + 3 I tried also selecting a photo or a video using the PHPicker* APIs, and although I get back the file, if I try to query the UTType from the file extension using the [UTType typeWithFilenameExtension:] method, I get back a nil result if the extension passed is either a "jpeg" or a "mp4". The above do not happen if I run the same simulator (iPhone 13 15.4 / Xcode 13.3) on an Intel Macbook Pro host machine, or on a real device. Any ideas?
9
0
3.3k
Mar ’22
Question regarding the kVTVideoEncoderList_IsHardwareAccelerated flag
I am a bit confused on whether certain Video Toolbox (VT) encoders support hardware acceleration or not. When I query the list of VT encoders (VTCopyVideoEncoderList(nil,&encoderList)) on an iPhone 14 Pro device, for avc1 (AVC / H.264) and hevc1 (HEVC / H.265) encoders, the kVTVideoEncoderList_IsHardwareAccelerated flag is not there, which -based on the documentation found on the VTVideoEncoderList.h- means that the encoders do not support hardware acceleration: optional. CFBoolean. If present and set to kCFBooleanTrue, indicates that the encoder is hardware accelerated. In fact, no encoders from this list return this flag as true and most of them do not include the flag at all on their dictionaries. On the other hand, when I create a compression session using the VTCompressionSessionCreate() and pass the kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder as true in the encoder specifications, after querying the kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder using the following code, I get a CFBoolean value of true for both H.264 and H.265 encoder. In fact, I get a true value (for both of the aforementioned encoders) even if I don't specify the kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder during the creation of the compression session (note here that this flag was introduced in iOS 17.4 ^1). So the question is: Are those encoders actually hardware accelerated on my device, and if so, why isn't that reflected on the VTCopyVideoEncoderList() call?
3
1
707
May ’24
Get notified on 'Selected Contacts' updates
Is there a way for the application to get notified when user updates their 'Selected Contacts' from the Settings app when the Contacts permission on the application is set to the new iOS 18 CNAuthorizationStatusLimited status? My logic already listens for the CNContactStoreDidChangeNotification notification, but it doesn't look like it is being fired under this scenario. Do we have to setup a new CNChangeHistoryFetchRequest every time the application becomes active and compare the result? Is the value of the currentHistoryToken updated when user selects / deselects entries from their 'Selected Contacts'?
2
0
512
Jul ’24