[英]Passing data between React-Native js and Obj-C Bridge
I've simplified my call to pass a simple string from react-native index.ios.js to Obj-C native module, and I still get an error: 我简化了将简单字符串从react-native index.ios.js传递到Obj-C本机模块的调用,但仍然出现错误:
'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
My code is as follows: 我的代码如下:
js (called by a TouchableOpacity component): js(由TouchableOpacity组件调用):
ring() {
Twilio.connect('+447842111281');
}
Obj-C: 对象:
RCT_EXPORT_METHOD(connect:(NSString *)number) {
NSDictionary *params = @{@"To": number};
_connection = [_phone connect:params delegate:nil];
}
If anyone has any insights that would be awesome. 如果有人有任何见解会很棒。
尝试使用convert宏:
NSString *numberString = [RCTConvert NSString:number]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.