gpt4 book ai didi

xcode - Twilio iOS 无法识别的选择器发送到类

转载 作者:行者123 更新时间:2023-12-01 09:08:55 25 4
gpt4 key购买 nike

我刚开始使用 Twilio,我希望有人可以帮助我调试我的应用程序。

我正在调用以获取功能 token ,它返回得很好。我在控制台中打印它以进行检查,然后当我调用 initWithCapabilityToken 时它会出现,这是出现问题的地方,我无法弄清楚。

这是我的代码...

[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:
^(NSURLResponse *response, NSData *data, NSError *error){
// Log Any Reply
if ([data length] >0 && error == nil) {
NSData *jsonData = data;

// Deserialize JSON into Dictionary
error = nil;
id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingAllowFragments
error:&error ];
if (jsonObject != nil && error == nil) {
NSLog(@"Successfully deserialized JSON response...");

if ([jsonObject isKindOfClass:[NSDictionary class]]) {
NSDictionary *deserializedDictionary = (NSDictionary *)jsonObject;
NSLog(@"Deserialized JSON Dictionary = %@", deserializedDictionary);

NSString *token = [deserializedDictionary objectForKey:@"token"];
if (token == nil) {
NSLog(@"Error retrieving token");
} else {
NSLog(@"Token: %@", token);
// Setup TCDevice
_phone = [[TCDevice alloc] initWithCapabilityToken:token delegate:self];
}
}
} else if (error != nil){
NSLog(@"An error happened while de-serializing the JSON data.");
}
}else if ([data length] == 0 && error == nil){
NSLog(@"Nothing was downloaded.");
}else if (error != nil){
NSLog(@"Error happened = %@", error);
}
}];

这是记录我的 token 后我得到的...

2015-01-29 16:32:14.637 AppName[4649:701822] +[NSString stringWithPJStr:]: unrecognized selector sent to class 0x3377da98
2015-01-29 16:32:14.639 AppName[4649:701822] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSString stringWithPJStr:]: unrecognized selector sent to class 0x3377da98'
*** First throw call stack:
(0x254da49f 0x32c90c8b 0x254df7d5 0x254dd7d7 0x2540f058 0x10ee7d 0x10e32b 0x10e2b7 0x105959 0x10568d 0x7b3ab 0x24fa228d 0x261d52b1 0x2614034d 0x26132b07 0x261d7c1b 0x487e29 0x4822c9 0x489567 0x48a891 0x33351e31 0x33351b84)
libc++abi.dylib: terminating with uncaught exception of type NSException

谢谢

最佳答案

阅读所有 Twilios 文档后,我发现我遗漏了一件事。我必须将 -ObjC 添加到其他链接器标志,这解决了我的问题。

关于xcode - Twilio iOS 无法识别的选择器发送到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28225344/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com