devicekit / DeviceKit

DeviceKit is a value-type replacement of UIDevice.
MIT License
4.42k stars 430 forks source link

[Q] Investigating crash with iOS 13.3 - Privacy for camera (?) #228

Closed brunomunizaf closed 4 years ago

brunomunizaf commented 4 years ago

Hi there,

I've been having a weird crash regarding privacy violation but funny thing is that I'm not using camera anywhere. Honestly, I don't use any permission on my info.plist besides of the location which became sort of standard for iOS apps quite some time ago. I'm debugging which 3rd party lib i'm using that could be causing it and it seems the only one that has something regarding camera is DeviceKit. I'm not convinced at all that this is causing these crashes but after a couple days I started running out of options lol. I added camera permission and re-submitted my app but tbh I have no idea whats going on. Anyone can tell me if DeviceKit would require NSPrivacyCamera... on the info.plist? PS: This is only happening with iOS 13 users so far.

Crashlytics - plaintext stacktrace downloaded by Bruno Muniz at Sat, 28 Dec 2019 06:31:01 GMT URL: Organization: Platform: ios Application: Version: Bundle Identifier: Issue ID: Session ID: *** Date: 2019-12-26T10:11:00Z OS Version: 13.3.0 (17C54) Device: iPhone SE RAM Free: 2.7% Disk Free: 32.5%

  1. Crashed: com.apple.root.default-qos 0 libsystem_kernel.dylib 0x1bbcf8930 __abort_with_payload + 8 1 libsystem_kernel.dylib 0x1bbcfcf24 abort_with_payload_wrapper_internal + 100 2 libsystem_kernel.dylib 0x1bbcfcf54 os_channel_create_extended.cold.1 + 10 3 TCC 0x1c2102cc8 TCCAccessRequest_block_invoke.132 + 190 4 TCC 0x1c2102c08 **CRASHING_DUE_TO_PRIVACY_VIOLATION** + 538 5 TCC 0x1c2106b28 tccd_send_message_block_invoke + 256 6 libxpc.dylib 0x1bbadac84 _xpc_connection_reply_callout + 60 7 libxpc.dylib 0x1bbacef18 _xpc_connection_call_reply_async + 76 8 libdispatch.dylib 0x1bbbcf204 _dispatch_client_callout3 + 16 9 libdispatch.dylib 0x1bbb8d0b0 _dispatch_mach_msg_async_reply_invoke$VARIANT$mp + 348 10 libdispatch.dylib 0x1bbb84c50 _dispatch_kevent_worker_thread + 1176 11 libsystem_pthread.dylib 0x1bbc1ebc0 _pthread_wqthread + 332 12 libsystem_pthread.dylib 0x1bbc21760 start_wqthread + 8

--

  1. com.apple.main-thread 0 libobjc.A.dylib 0x1bbc2dba8 bool objc::DenseMapBase<objc::DenseMap<objc_class, objc::category_list, objc::DenseMapValueInfo, objc::DenseMapInfo<objc_class>, objc::detail::DenseMapPair<objc_class, objc::category_list> >, objc_class, objc::category_list, objc::DenseMapValueInfo, objc::DenseMapInfo<objc_class>, objc::detail::DenseMapPair<objc_class, objc::category_list> >::LookupBucketFor<objc_class const>(objc_class const const&, objc::detail::DenseMapPair<objc_class, objc::category_list> const&) const + 184 1 libobjc.A.dylib 0x1bbc2c860 realizeClassWithoutSwift(objc_class, objc_class) + 1592 2 libobjc.A.dylib 0x1bbc2bff0 realizeClassMaybeSwiftMaybeRelock(objc_class, mutex_tt&, bool) + 100 3 libobjc.A.dylib 0x1bbc2bb00 initializeAndMaybeRelock(objc_class, objc_object*, mutex_tt&, bool) + 116 4 libobjc.A.dylib 0x1bbc3850c lookUpImpOrForward + 700 5 libobjc.A.dylib 0x1bbc263fc _objc_msgSend_uncached + 60 6 CameraUI 0x1ddcbb4f8 -[CAMViewfinderViewController _createModeSpecificControlsForConfiguration:] 7 CameraUI 0x1ddc33e3c -[CAMViewfinderViewController _updateForCurrentConfiguration] 8 CameraUI 0x1ddc1dc70 -[CAMViewfinderViewController viewDidLoad] 9 UIKitCore 0x1bf956920 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100 10 UIKitCore 0x1bf95b430 -[UIViewController loadViewIfRequired] + 936 11 UIKitCore 0x1bf95b838 -[UIViewController view] + 28 12 CameraUI 0x1ddc42b1c -[CAMViewfinderViewController _autoHideHomeIndicatorForOrientation:] 13 UIKitCore 0x1bf74b484 -[_UISystemAppearanceManager updateHomeIndicatorAutoHidden] + 136 14 UIKitCore 0x1bf979260 59-[UIViewController setNeedsUpdateOfHomeIndicatorAutoHidden]_block_invoke_2 + 120 15 UIKitCore 0x1bf9599ac -[UIViewController _updateSystemAppearanceWithRecursionBlock:action:] + 300 16 UIKitCore 0x1bf9598e0 -[UIViewController _updateSystemAppearanceWithRecursionBlock:action:] + 96 17 UIKitCore 0x1bf9598e0 -[UIViewController _updateSystemAppearanceWithRecursionBlock:action:] + 96 18 UIKitCore 0x1bf8b77d8 -[UINavigationController _setViewControllers_7_0:transition:animated:operation:] + 1396 19 UIKitCore 0x1bf8b6ea0 -[UINavigationController _setViewControllers:transition:animated:operation:] + 676 20 UIKitCore 0x1bf8b60fc 54-[UINavigationController setViewControllers:animated:]_block_invoke + 1140 21 UIKitCore 0x1bf96862c +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 168 22 UIKitCore 0x1bf8b5b58 -[UINavigationController setViewControllers:animated:] + 388 23 UIKitCore 0x1bf8b1f18 -[UIImagePickerController _handleTopViewControllerReadyForDisplay:] + 180 24 UIKitCore 0x1bf8b1e24 79-[UIImagePickerController _setupControllersForCurrentSourceTypeWithCompletion:]_block_invoke + 112 25 UIKitCore 0x1bf8afd30 -[UIImagePickerController _createInitialControllerWithCompletion:] + 384 26 UIKitCore 0x1bf8b1d90 -[UIImagePickerController _setupControllersForCurrentSourceTypeWithCompletion:] + 112 27 UIKitCore 0x1bf8af340 -[UIImagePickerController viewWillAppear:] + 204 28 UIKitCore 0x1bf960ab8 -[UIViewController _setViewAppearState:isAnimating:] + 608 29 UIKitCore 0x1bf961160 -[UIViewController viewWillAppear:] + 124 30 UIKitCore 0x1bf87e310 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.465 + 1328 31 UIKitCore 0x1bff7f128 _runAfterCACommitDeferredBlocks + 316 32 UIKitCore 0x1bff6ec78 _cleanUpAfterCAFlushAndRunDeferredBlocks + 232 33 UIKitCore 0x1bff9eac8 _afterCACommitHandler + 76 34 CoreFoundation 0x1bbe7fe68 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 35 CoreFoundation 0x1bbe7ad54 CFRunLoopDoObservers + 416 36 CoreFoundation 0x1bbe7b320 CFRunLoopRun + 1308 37 CoreFoundation 0x1bbe7aadc CFRunLoopRunSpecific + 464 38 GraphicsServices 0x1c5e00328 GSEventRunModal + 104 39 UIKitCore 0x1bff75ae0 UIApplicationMain + 1936 40 -ios 0x100c72db4 main + 16 (.swift:16) 41 libdyld.dylib 0x1bbd04360 start + 4

  2. com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x1bbcd8634 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1bbcd7aa0 mach_msg + 72 2 CoreFoundation 0x1bbe80288 CFRunLoopServiceMachPort + 216 3 CoreFoundation 0x1bbe7b3a8 CFRunLoopRun + 1444 4 CoreFoundation 0x1bbe7aadc CFRunLoopRunSpecific + 464 5 Foundation 0x1bc1ba7f4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228 6 Foundation 0x1bc1ba6d4 -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 7 UIKitCore 0x1c000e204 -[UIEventFetcher threadMain] + 152 8 Foundation 0x1bc2eb0a4 NSThreadstart__ + 848 9 libsystem_pthread.dylib 0x1bbc1dd8c _pthread_start + 156 10 libsystem_pthread.dylib 0x1bbc2176c thread_start + 8

  3. com.twitter.crashlytics.ios.MachExceptionServer 0 libsystem_kernel.dylib 0x1bbcd8634 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1bbcd7aa0 mach_msg + 72 2 ***-ios 0x100cc5ff0 CLSMachExceptionServer + 180 (CLSMachException.c:180) 3 libsystem_pthread.dylib 0x1bbc1dd8c _pthread_start + 156 4 libsystem_pthread.dylib 0x1bbc2176c thread_start + 8

  4. com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x1bbcd8634 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x1bbcd7aa0 mach_msg + 72 2 CoreFoundation 0x1bbe80288 CFRunLoopServiceMachPort + 216 3 CoreFoundation 0x1bbe7b3a8 CFRunLoopRun + 1444 4 CoreFoundation 0x1bbe7aadc CFRunLoopRunSpecific + 464 5 CFNetwork 0x1bf1314e8 (Missing) 6 Foundation 0x1bc2eb0a4 NSThreadstart__ + 848 7 libsystem_pthread.dylib 0x1bbc1dd8c _pthread_start + 156 8 libsystem_pthread.dylib 0x1bbc2176c thread_start + 8

  5. JavaScriptCore bmalloc scavenger 0 libsystem_kernel.dylib 0x1bbcf9c94 psynch_cvwait + 8 1 libsystem_pthread.dylib 0x1bbc16cf8 _pthread_cond_wait$VARIANT$mp + 680 2 libc++.1.dylib 0x1bbd4c7a8 std::__1::condition_variable::wait(std::1::unique_lock&) + 24 3 JavaScriptCore 0x1cac7d22c void std::1::condition_variable_any::wait<std::1::unique_lock >(std::1::unique_lock&) + 108 4 JavaScriptCore 0x1cac80bfc bmalloc::Scavenger::threadRunLoop() + 200 5 JavaScriptCore 0x1cac808e4 bmalloc::Scavenger::Scavenger(std::__1::lock_guard&) + 10 6 JavaScriptCore 0x1cac81bf0 std::1::thread_specific_ptr<std::1::thread_struct>::set_pointer(std::1::__thread_struct*) + 38 7 libsystem_pthread.dylib 0x1bbc1dd8c _pthread_start + 156 8 libsystem_pthread.dylib 0x1bbc2176c thread_start + 8

  6. Thread 0 libsystem_kernel.dylib 0x1bbcfaa7c __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x1bbc1ebd4 _pthread_wqthread + 352 2 libsystem_pthread.dylib 0x1bbc21760 start_wqthread + 8

  7. com.apple.camera.capture-engine.session-queue 0 libsystem_kernel.dylib 0x1bbcfa8b8 ulock_wait + 8 1 libsystem_platform.dylib 0x1bbc0cf54 _os_unfair_lock_lock_slow + 224 2 libobjc.A.dylib 0x1bbc382d4 lookUpImpOrForward + 132 3 libobjc.A.dylib 0x1bbc263fc _objc_msgSend_uncached + 60 4 Foundation 0x1bc2af4f4 NSKeyValueWillChange + 332 5 Foundation 0x1bc2acec4 NSKeyValueWillChangeWithPerThreadPendingNotifications.llvm.947807775919258276 + 384 6 AVFoundation 0x1c5f9a358 -[AVCaptureFigVideoDevice _setActiveFormat:resetVideoZoomFactorAndMinMaxFrameDurations:] + 132 7 AVFoundation 0x1c5fcb01c -[AVCaptureSession _updateDeviceActiveFormatsAndActiveConnections] + 2884 8 AVFoundation 0x1c5fc9df0 -[AVCaptureSession _buildAndRunGraph] + 84 9 AVFoundation 0x1c5fc3ea0 -[AVCaptureSession _commitConfiguration] + 100 10 AVFoundation 0x1c5fc4a40 -[AVCaptureSession addInput:] + 648 11 CameraUI 0x1dddbf214 67-[AVCaptureSession(CAMCaptureEngine) cam_ensureInputs:exclusively:]_block_invoke.18 12 CoreFoundation 0x1bbed595c NSARRAY_IS_CALLING_OUT_TO_A_BLOCK + 16 13 CoreFoundation 0x1bbdd8bc8 -[NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 88 14 CameraUI 0x1dddbf0ac -[AVCaptureSession(CAMCaptureEngine) cam_ensureInputs:exclusively:] 15 CameraUI 0x1ddc20ac4 -[CAMModeAndDeviceCommand executeWithContext:] 16 CameraUI 0x1ddc201ac -[CAMCaptureEngine _executeCommand:withContext:] 17 CameraUI 0x1ddc20260 -[CAMCaptureEngine _executeCommand:withContext:] 18 CameraUI 0x1ddc20260 -[CAMCaptureEngine _executeCommand:withContext:] 19 CameraUI 0x1ddc1fd2c 35-[CAMCaptureEngine enqueueCommand:]_block_invoke 20 AssetsLibraryServices 0x1d03e486c __pl_dispatch_async_block_invoke + 36 21 libdispatch.dylib 0x1bbbce610 _dispatch_call_block_and_release + 24 22 libdispatch.dylib 0x1bbbcf184 _dispatch_client_callout + 16 23 libdispatch.dylib 0x1bbb7b404 _dispatch_lane_serial_drain$VARIANT$mp + 608 24 libdispatch.dylib 0x1bbb7bdf8 _dispatch_lane_invoke$VARIANT$mp + 420 25 libdispatch.dylib 0x1bbb85314 _dispatch_workloop_worker_thread + 588 26 libsystem_pthread.dylib 0x1bbc1eb88 _pthread_wqthread + 276 27 libsystem_pthread.dylib 0x1bbc21760 start_wqthread + 8

  8. Crashed: com.apple.root.default-qos 0 libsystem_kernel.dylib 0x1bbcf8930 __abort_with_payload + 8 1 libsystem_kernel.dylib 0x1bbcfcf24 abort_with_payload_wrapper_internal + 100 2 libsystem_kernel.dylib 0x1bbcfcf54 os_channel_create_extended.cold.1 + 10 3 TCC 0x1c2102cc8 TCCAccessRequest_block_invoke.132 + 190 4 TCC 0x1c2102c08 **CRASHING_DUE_TO_PRIVACY_VIOLATION** + 538 5 TCC 0x1c2106b28 tccd_send_message_block_invoke + 256 6 libxpc.dylib 0x1bbadac84 _xpc_connection_reply_callout + 60 7 libxpc.dylib 0x1bbacef18 _xpc_connection_call_reply_async + 76 8 libdispatch.dylib 0x1bbbcf204 _dispatch_client_callout3 + 16 9 libdispatch.dylib 0x1bbb8d0b0 _dispatch_mach_msg_async_reply_invoke$VARIANT$mp + 348 10 libdispatch.dylib 0x1bbb84c50 _dispatch_kevent_worker_thread + 1176 11 libsystem_pthread.dylib 0x1bbc1ebc0 _pthread_wqthread + 332 12 libsystem_pthread.dylib 0x1bbc21760 start_wqthread + 8

Zandor300 commented 4 years ago

DeviceKit shouldn't need the camera permission entry since it isn't interacting with cameras. Regarding the camera features that are in DeviceKit, it is just retrieving which cameras are available on any given device model but these are hardcoded.

https://github.com/devicekit/DeviceKit/blob/529dfe802ce4ef143f2a55e47475dcbb9f89fb4d/Source/Device.generated.swift#L1342-L1390

brunomunizaf commented 4 years ago

@Zandor300 That's what I thought so... anyways thanks for your help. Happy holidays

Zandor300 commented 4 years ago

@brunomunizaf Thanks! You too.