gpt4 book ai didi

iphone - [__NSCFNumber 长度] : unrecognized selector sent to instance 0x6d21350

转载 作者:IT王子 更新时间:2023-10-29 08:04:16 31 4
gpt4 key购买 nike

这个错误意味着什么?

[__NSCFNumber length]: unrecognized selector sent to instance 0x6d21350

这是我的代码:

    NSString *urlString = @"http://api.twitter.com/1/statuses/update.json";
NSURL *url = [NSURL URLWithString:urlString];

NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[params setObject:status forKey:@"status"];
[params setObject:replyToID forKey:@"in_reply_to_status_id"];
[params setObject:@"1" forKey:@"include_entities"];

// Build the request with our parameter
TWRequest *request = [[TWRequest alloc] initWithURL:url parameters:params requestMethod:TWRequestMethodPOST];

// Attach the account object to this request
[request setAccount:twitterAccount];

[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (!responseData) {
// inspect the contents of error
NSLog(@"%@", [error localizedDescription]);

self.alert = [[UIAlertView alloc] initWithTitle:@"HTTP error" message:@"I could not connect to the Twitter API." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[self.alert show];

[self.replyDelegate replyRequestSuccessful:NO];
}
else {
/*NSString *responseDataAsString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(responseDataAsString);*/

NSError *error;
NSArray *replyResponse = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];

if (!replyResponse) {
NSLog(@"%@", [error localizedDescription]);

self.alert = [[UIAlertView alloc] initWithTitle:@"JSON error" message:@"I could not parse the JSON response from the Twitter API." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[self.alert show];

[self.replyDelegate replyRequestSuccessful:NO];
}
else {
[self.replyDelegate replyRequestSuccessful:YES];
}
}
}];

我试过debuggin,一进入performRequestWithHandler就死掉了。它进入 else block 并因上述错误而终止。

最佳答案

这意味着您正在传递一个 NSNumber,其中被调用的代码需要一个 NSString 或其他具有 length 方法的对象。您可以告诉 Xcode 在出现异常时中断,以便您看到调用 length 方法的确切位置。

关于iphone - [__NSCFNumber 长度] : unrecognized selector sent to instance 0x6d21350,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10095459/

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