We have been trying for few months now to add Zendesk SDK to our App, so customers can use Zendesk chat to communicate with us. Currently we use Facebook chat in the app.
However, each of our attempts results in app crash when we open the chat and start writing something.
We have tried to look in the KB, but this App crashes doesn't help.
Versions:
react-native: 0.67.1
ZendeskChatSDK (2.12.0)
ZendeskChatProvidersSDK (2.12.0)
Native source code:
RCT_EXPORT_METHOD(startChat) {
ZDKMessagingConfiguration *messagingConfiguration = [[ZDKMessagingConfiguration alloc] init];
messagingConfiguration.name = @"Chat Bot";
ZDKChatAPIConfiguration *chatAPIConfiguration = [[ZDKChatAPIConfiguration alloc] init];
chatAPIConfiguration.department = @"Department name";
chatAPIConfiguration.departmentName = @"Department name";
chatAPIConfiguration.visitorInfo = [[ZDKVisitorInfo alloc] initWithName:@"Name" email:@"email@gmail.com" phoneNumber:@"01013243"];
ZDKChatConfiguration *chatConfiguration = [[ZDKChatConfiguration alloc] init];
chatConfiguration.isPreChatFormEnabled = YES;
ZDKChat.instance.configuration = chatAPIConfiguration;
// Build view controller
NSError *error = nil;
NSArray *engines = @[
(id <ZDKEngine>) [ZDKChatEngine engineAndReturnError:&error]
];
UIViewController *viewController = [ZDKMessaging.instance buildUIWithEngines:engines configs:@[messagingConfiguration, chatConfiguration] error:&error];
// Present view controller
// [self.navigationController pushViewController:viewController animated:YES];
UINavigationController *chatController = [[UINavigationController alloc] initWithRootViewController: viewController];
[RCTPresentedViewController() presentViewController:chatController animated:YES completion:nil]; // react-native wrapper
}
and error:
2022-05-02 11:26:17.262786+0000 Nova[23483:4376151] [native] Exception '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' was thrown while invoking startChat on target RNZendeskChatModule with params (
)
callstack: (
0 CoreFoundation 0x00007fff203feba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2047ef64 _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff2047cf4a -[__NSPlaceholderArray initWithCapacity:].cold.1 + 0
4 CoreFoundation 0x00007fff202ff25e -[__NSPlaceholderArray initWithObjects:count:] + 154
5 CoreFoundation 0x00007fff203eb333 +[NSArray arrayWithObjects:count:] + 40
6 XXXX 0x000000010ec4b7e6 -[RNZendeskChatModule startChat] + 502
7 CoreFoundation 0x00007fff2040546c __invoking___ + 140
8 CoreFoundation 0x00007fff20402862 -[NSInvocation invoke] + 305
9 CoreFoundation 0x00007fff20402af5 -[NSInvocation invokeWithTarget:] + 70
10 XXXX 0x000000010ece8b57 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2599
11 XXXX 0x000000010eced09c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1436
12 XXXX 0x000000010ecec92e _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 158
13 XXXX 0x000000010ecec889 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
14 libdispatch.dylib 0x00000001128a6848 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x00000001128a7a2c _dispatch_client_callout + 8
16 libdispatch.dylib 0x00000001128ae3a6 _dispatch_lane_serial_drain + 845
17 libdispatch.dylib 0x00000001128af0bc _dispatch_lane_invoke + 436
18 libdispatch.dylib 0x00000001128bb472 _dispatch_workloop_worker_thread + 900
19 libsystem_pthread.dylib 0x00007fff6da2845d _pthread_wqthread + 314
20 libsystem_pthread.dylib 0x00007fff6da2742f start_wqthread + 15
)