zendesk / react-native-sunshine-conversations

React Native wrapper for Smooch.io
MIT License
36 stars 26 forks source link

Smooch.login throws exception on iOS #46

Closed adbl closed 6 years ago

adbl commented 6 years ago

Updating from a previous version of this library, now when calling Smooch.login we get an exception:

2017-10-26 23:23:13.671 [error][tid:com.facebook.react.SmoochManagerQueue][RCTModuleMethod.mm:362] Unknown argument type 'void' in method -[SmoochManager login:jwt:completionHandler:]. Extend RCTConvert to support this type.
2017-10-26 23:23:13.671335+0200 ShimClient[54861:10639652] Unknown argument type 'void' in method -[SmoochManager login:jwt:completionHandler:]. Extend RCTConvert to support this type.
2017-10-26 23:23:13.674 [error][tid:com.facebook.react.SmoochManagerQueue][RCTModuleMethod.mm:60] Argument 2 (void) of SmoochManager.login is marked as nullable, but is not a nullable type.
2017-10-26 23:23:13.673927+0200 ShimClient[54861:10639652] Argument 2 (void) of SmoochManager.login is marked as nullable, but is not a nullable type.
2017-10-26 23:23:13.676 [fatal][tid:com.facebook.react.SmoochManagerQueue] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]' was thrown while invoking login on target SmoochManager with params (
    "...",
    "..."
)
2017-10-26 23:23:13.676331+0200 ShimClient[54861:10639652] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]' was thrown while invoking login on target SmoochManager with params (
    "...",
    "..."
)

I can see that the native method has changed to include a third argument completionHandler, I guess given the first error that this argument type is not support automatically for react native bridge modules, I also note that there is no third argument passed from the login js method.

I suppose this callback have to be handled using RCTPromiseResolveBlock/RCTPromiseRejectBlock, or completionHandler ignored.