Crash when presenting UIImagePickerController

Answered

This code crashes on iOS in Fullstory 1.55.0, but does not crash in Fullstory 1.54.0:

let cameraViewController = UIImagePickerController()

cameraViewController.sourceType = .camera

let presentCamera = { [weak self] in

   DispatchQueue.main.async {

       cameraViewController.delegate = self?.cameraImagePickerManager

       self?.sourceViewController.present(cameraViewController, animated: true)

   }

}

presentCamera()

I have confirmed Fullstory is the culprit by isolating my upgrade to 1.55.0 as the only change when causing the crash. Here is the stack trace:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 0}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.'

          Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x2d5ec __exceptionPreprocess
1  libobjc.A.dylib                0x31244 objc_exception_throw
2  Foundation                     0x82dff0 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:]
3  UIKitCore                      0xd90d0 _UIGraphicsBeginImageContextWithOptions
4  CameraEditKit                  0x1c694 -[CEKBadgeTextView _maskImage]
5  CameraEditKit                  0x34128 -[CEKBadgeView drawRect:]
6  UIKitCore                      0xd7a8c -[UIView(CALayerDelegate) drawLayer:inContext:]
7  FullStory                      0xdae00 (Missing UUID 2fd33ecbbb7f3eda9140074faceb41fa)
8  FullStory                      0xccef8 (Missing UUID 2fd33ecbbb7f3eda9140074faceb41fa)
9  FullStory                      0xdabe0 (Missing UUID 2fd33ecbbb7f3eda9140074faceb41fa)
10 FullStory                      0xdf7f0 (Missing UUID 2fd33ecbbb7f3eda9140074faceb41fa)
11 libdispatch.dylib              0x3fa8 _dispatch_client_callout
12 libdispatch.dylib              0x138d4 _dispatch_async_and_wait_invoke
13 libdispatch.dylib              0x3fa8 _dispatch_client_callout
14 libdispatch.dylib              0x12a34 _dispatch_main_queue_drain
15 libdispatch.dylib              0x1264c _dispatch_main_queue_callback_4CF
16 CoreFoundation                 0x79bbc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
17 CoreFoundation                 0x761b0 __CFRunLoopRun
18 CoreFoundation                 0xc8274 CFRunLoopRunSpecific
19 GraphicsServices               0x14c0 GSEventRunModal
20 UIKitCore                      0x3ee77c -[UIApplication _run]
21 UIKitCore                      0x14e64 UIApplicationMain
22 myfirstam                      0x818c main + 6 (main.swift:6)
23 ???                            0x1b90ecde8 (Missing)

0

Comments

6 comments

  • Official comment

    Hi Adam Johns,

    Thanks for reaching out about this!

    We have recently been made aware of this issue and we're currently working on a fix that will go out with our next release (1.56.0) next week.

    This issue only appears to affect SDK version 1.55.0 (as you noted) and causes a crash whenever the camera is opened on iOS 17 and 18. Excluding CAMViewfinderView has worked well to prevent crashes as an interim solution in the meantime.

    For further updates, keep an eye on our release notes page here: Fullstory for Mobile Apps Release Notes.

    All the best,
    Allegra

  • Allegra Anka thanks for the quick response. Could you explain what you mean by excluding CAMViewFinderView? Do you have a code snippet? Do you mean setting showsCameraControls to false and then making my own custom camera controls?

    0
  • Hi Adam Johns ,

    You can create an exclusion rule by following these steps:

    1. Navigate to Settings > Data Capture and Privacy > Privacy.
    2. Within the Element Data Capture Rules section, click on Create Rule.
    3. Add a rule to exclude CAMViewfinderView.

    Let me know if you need further assistance!

    Best,
    Uday

    0
  • Uday Alla thanks, that workaround worked for us!

    0
  • Hi Allegra Anka
     

    Do you have an update on when this fix will be released? The work around does not work for us and the image picker is being triggered by a webview, and we can't turn off the tracking for the webview.

    0
  • Hi Gareth Lloyd ,

    The fix is now available in v1.56 of our SDK, which was released yesterday. Please update to this version and let us know if it resolves your issue.

    Thanks,
    Uday

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post