crisp-im / crisp-sdk-ios

:package: Crisp iOS SDK, add a chat in any iOS app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/ios-sdk/
Other
43 stars 18 forks source link

[Crash] Crisp.AlertViewController this class is not key value coding-compliant for the key alertView. #59

Closed Ferannor closed 2 years ago

Ferannor commented 3 years ago

Hi guys,

We have a problem each time we present ChatViewController.

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Crisp.AlertViewController 0x150cfe550> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key alertView.'

Stacktrace


    0   CoreFoundation                      0x0000000115235978 __exceptionPreprocess + 236
    1   libobjc.A.dylib                     0x0000000114df5800 objc_exception_throw + 56
    2   CoreFoundation                      0x0000000115235628 -[NSException init] + 0
    3   Foundation                          0x000000010d1a6904 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 312
    4   UIKitCore                           0x0000000119fa2600 -[UIViewController setValue:forKey:] + 80
    5   UIKitCore                           0x000000011a2ac4d0 -[UIRuntimeOutletConnection connect] + 124
    6   CoreFoundation                      0x000000011521dea4 -[NSArray makeObjectsPerformSelector:] + 232
    7   UIKitCore                           0x000000011a2a8634 -[UINib instantiateWithOwner:options:] + 1900
    8   UIKitCore                           0x0000000119fa9c6c -[UIViewController loadView] + 588
    9   UIKitCore                           0x0000000119fa9ff8 -[UIViewController loadViewIfRequired] + 172
    10  UIKitCore                           0x0000000119faa6b8 -[UIViewController view] + 28
    11  Crisp                               0x000000010be8c280 __swift_memcpy48_8 + 18540
    12  Crisp                               0x000000010be8bd9c __swift_memcpy48_8 + 17288
    13  Crisp                               0x000000010bee61d4 block_destroy_helper + 8220
    14  Crisp                               0x000000010bee6acc block_destroy_helper + 10516
    15  Crisp                               0x000000010bf5cd64 block_destroy_helper.5 + 16876
    16  Crisp                               0x000000010bf5b100 block_destroy_helper.5 + 9608
    17  Crisp                               0x000000010bf5bcb4 block_destroy_helper.5 + 12604
    18  Crisp                               0x000000010bf5b9a0 block_destroy_helper.5 + 11816
    19  Crisp                               0x000000010be6e51c __swift_memcpy24_8 + 1240
    20  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    21  Crisp                               0x000000010bfa65b8 __swift_memcpy41_8 + 1160
    22  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    23  Crisp                               0x000000010bf49874 block_destroy_helper.24 + 3928
    24  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    25  Crisp                               0x000000010bf743a4 block_destroy_helper.11 + 12384
    26  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    27  Crisp                               0x000000010bf74a90 block_destroy_helper + 664
    28  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    29  Crisp                               0x000000010becff20 __swift_memcpy9_8 + 4292
    30  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    31  Crisp                               0x000000010bf596a8 block_destroy_helper.5 + 2864
    32  Crisp                               0x000000010bec30c4 UIEdgeInsetsInsetRect + 11308
    33  Crisp                               0x000000010be71148 __swift_memcpy25_8 + 8512
    34  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    35  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    36  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    37  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    38  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    39  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    40  Crisp                               0x000000010bec3094 UIEdgeInsetsInsetRect + 11260
    41  Crisp                               0x000000010bf5db78 block_destroy_helper.5 + 20480
    42  Crisp                               0x000000010bf5c9d0 block_destroy_helper.5 + 15960
    43  Crisp                               0x000000010bf5cb60 block_destroy_helper.5 + 16360
    44  Crisp                               0x000000010becaf50 block_destroy_helper + 14592
    45  Crisp                               0x000000010bece738 block_destroy_helper + 3248
    46  Crisp                               0x000000010beca008 block_destroy_helper + 10680
    47  Crisp                               0x000000010bf5e1dc block_destroy_helper.5 + 22116
    48  Crisp                               0x000000010bfc3268 block_destroy_helper + 23748
    49  Crisp                               0x000000010bfc35d4 block_destroy_helper + 24624
    50  Crisp                               0x000000010bfcdf04 block_destroy_helper.22 + 30140
    51  Crisp                               0x000000010bfd29c8 block_destroy_helper + 440
    52  Crisp                               0x000000010bec766c block_destroy_helper + 28
    53  libdispatch.dylib                   0x00000001193180b4 _dispatch_call_block_and_release + 24
    54  libdispatch.dylib                   0x0000000119319884 _dispatch_client_callout + 16
    55  libdispatch.dylib                   0x0000000119327f84 _dispatch_main_queue_callback_4CF + 1044
    56  CoreFoundation                      0x00000001151a3d1c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    57  CoreFoundation                      0x000000011519e25c __CFRunLoopRun + 2448
    58  CoreFoundation                      0x000000011519d3bc CFRunLoopRunSpecific + 572
    59  GraphicsServices                    0x00000001219eb70c GSEventRunModal + 160
    60  UIKitCore                           0x000000011a6673d0 -[UIApplication _run] + 964
    61  UIKitCore                           0x000000011a66c1ac UIApplicationMain + 112
    62  navily                              0x0000000105188d04 main + 84
    63  libdyld.dylib                       0x00000001193ad554 start + 4
)
libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Crisp.AlertViewController 0x150cfe550> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key alertView.'
terminating with uncaught exception of type NSException```
nesium commented 2 years ago

Hi @Ferannor. Thanks for your report! How are you presenting ChatViewController. Are you possibly referencing it in a XIB/storyboard? What looks odd to me are the [UINib instantiateWithOwner:options:] and [UIRuntimeOutletConnection connect] bits, since we're not using any XIBs and thus have no IBOutlets.

Ferannor commented 2 years ago

hi @nesium, I'm presenting the ChatViewController like this : present(ChatViewController(), animated: true) But I've a custom xib in my project called AlertViewController. How did you call AlertViewController on your side? AlertViewController or Crisp.AlertViewController?

nesium commented 2 years ago

It's AlertViewController. Crisp is just the module name. Could it be possible that the wrong module is specified in Interface Builder?

Screenshot 2021-09-21 at 19 25 01