के लिए भेजा इस त्रुटि क्या मतलब हो सकता है?[__NSCFNumber लंबाई]: गैर मान्यता प्राप्त चयनकर्ता उदाहरण 0x6d21350
[__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 प्रवेश करती है। यह अन्य ब्लॉक चला जाता है और ऊपर की त्रुटि के साथ मर जाता है।
अधिक संभावना है, वहाँ उनकी स्मृति प्रबंधन के साथ एक मुद्दा है, और रनटाइम/ढांचा एक NSString कि (समय से पहले आवंटन रद्द करने से) अब वहां नहीं है उम्मीद कर रही है, और एक NSNumber वहाँ के बजाय आबंटित की गई है। यदि आप उद्देश्य से 'NSNumber' को 'लंबाई' भेजने का प्रयास करते हैं, तो संकलक आपको आशा करता है कि आपको चेतावनी दी जाएगी। – dreamlax
'NSNumber' एक शब्दकोश में या किसी अन्य इंटरफ़ेस प्रकार मिटा देता है के माध्यम से पारित कर दिया है, तो ऐसा नहीं है। लेकिन आप सही हैं, यह काफी संभावना है कि वह कुछ खत्म कर रहा है। 'NSZombieEnabled' के साथ प्रयास करना एक अच्छा विचार हो सकता है। – zoul
आप "प्रकार मिटा देता है" से क्या मतलब है? – dreamlax