tinycreative / react-native-intercom

React Native wrapper for Intercom.io
MIT License
405 stars 279 forks source link

IOS - crashing on attach photo #321

Closed felippepuhle closed 5 years ago

felippepuhle commented 5 years ago

Hey guys, how are you?

Just noticed that if I try to attach a photo on a conversation, my app suddenly crashes and I don't know what's going on.

2019-10-15 13:53:28.125793-0300 native[35506:918980] API error: <_UIKBCompatInputView: 0x7ffac5ca6ec0; frame = (0 0; 0 0); layer = <CALayer: 0x6000038db380>> returned 0 width, assuming UIViewNoIntrinsicMetric
2019-10-15 13:53:28.126124-0300 native[35506:918980] API error: <_UIKBCompatInputView: 0x7ffac5ca6ec0; frame = (0 0; 0 0); layer = <CALayer: 0x6000038db380>> returned 0 width, assuming UIViewNoIntrinsicMetric
2019-10-15 13:53:28.130129-0300 native[35506:918980] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    "<NSLayoutConstraint:0x600001a49360 'assistantHeight' TUISystemInputAssistantView:0x7ffac5dbda80.height == 45   (active)>",
    "<NSLayoutConstraint:0x600001a30dc0 'assistantView.bottom' TUISystemInputAssistantView:0x7ffac5dbda80.bottom == UIInputView:0x7ffac8010530.top   (active)>",
    "<NSLayoutConstraint:0x600001a30d70 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x7ffac820a040]-(0)-[TUISystemInputAssistantView:0x7ffac5dbda80]   (active)>",
    "<NSLayoutConstraint:0x600001a30690 'inputView.top' V:[_UIRemoteKeyboardPlaceholderView:0x7ffac820a040]-(0)-[UIInputView:0x7ffac8010530]   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600001a30d70 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x7ffac820a040]-(0)-[TUISystemInputAssistantView:0x7ffac5dbda80]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2019-10-15 13:53:28.608749-0300 native[35506:918980] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23baa1ee __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff50864b20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23c3cb71 _CFThrowFormattedException + 194
    3   CoreFoundation                      0x00007fff23c47596 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.4 + 38
    4   CoreFoundation                      0x00007fff23c07f17 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 247
    5   CoreFoundation                      0x00007fff23ba609b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
    6   native                              0x000000010efa8713 +[IntercomSDK_ITBBlockUtils imageBlockForUpload:appearance:] + 298
    7   native                              0x000000010f0d134e +[ICMConversationPart sendingPartWithBlocks:upload:] + 607
    8   native                              0x000000010f0b38e5 -[ICMConversationContentViewController replyToConversationWithBlocks:upload:] + 215
    9   native                              0x000000010f0b1975 -[ICMConversationContentViewController sendUpload:] + 177
    10  native                              0x000000010f08c36f -[ICMConversationViewController sendMessage:upload:] + 179
    11  native                              0x000000010f08be94 __74-[ICMConversationViewController inputAccessoryView:input:performedAction:]_block_invoke + 96
    12  libdispatch.dylib                   0x000000011201cdf8 _dispatch_call_block_and_release + 12
    13  libdispatch.dylib                   0x000000011201dd6c _dispatch_client_callout + 8
    14  libdispatch.dylib                   0x000000011202be24 _dispatch_main_queue_callback_4CF + 1500
    15  CoreFoundation                      0x00007fff23b0ce49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    16  CoreFoundation                      0x00007fff23b07aa9 __CFRunLoopRun + 2329
    17  CoreFoundation                      0x00007fff23b06e66 CFRunLoopRunSpecific + 438
    18  GraphicsServices                    0x00007fff38346bb0 GSEventRunModal + 65
    19  UIKitCore                           0x00007fff47578dd0 UIApplicationMain + 1621
    20  native                              0x000000010e9c51f0 main + 112
    21  libdyld.dylib                       0x00007fff516ecd29 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Any thoughts?

Thanks

makirby commented 5 years ago

Have you added a privacy description for accessing photos?

felippepuhle commented 5 years ago

Hey @makirby! Yes, we've added NSPhotoLibraryUsageDescription as suggested here

makirby commented 5 years ago

Oh I see it's when the image is actually attached. I tried it myself and we actually get the same crash 😅

Was able to resolve by bumping the iOS intercom lib pod 'Intercom', '~> 5.5.1'

I don't know if this causes any other side effects though.

felippepuhle commented 5 years ago

Wow, it works! Thanks @makirby!

I'll open a PR fixing it, but apparently this repo is out of date! Current NPM version is 13.1.0 (https://www.npmjs.com/package/react-native-intercom) whereas the current package.jsoncontains 13.0.1 (https://github.com/tinycreative/react-native-intercom/blob/master/package.json#L3)

smakosh commented 4 years ago

Can we re-open this as I'm still facing this issue on the latest npm package version on iOS 13 and RN 0.61.2

ghsdh3409 commented 4 years ago

I checked that it fixed on react-native-intercom 13.2.0 and intercom-ios 5.5.2.

smakosh commented 4 years ago

I checked that it fixed on react-native-intercom 13.2.0 and intercom-ios 5.5.2.

Using the same version but the app still crashes

shelbygold commented 4 years ago

I am having the same issue, I have updated to the latest version but am still getting crashes every time an image is added to a chat. not having this issue on web or android just iOS

dumbest commented 4 years ago

In my case, I installed Intercom manually. react-native-intercom is 13.2.0 Issue resolved after I download a new intercom.framework.