我一直想這個Twitter的API的東西,這真是混亂...EXC_BAD_ACCESS -iPhone目標C
我不斷收到EXC_BAD_ACCESS壞訪問下面的代碼...這裏有什麼問題嗎?
NSURL *followingURL = [NSURL URLWithString:@"https://api.twitter.com/1/users/lookup.json"];
// Pass in the parameters (basically '.ids.json?screen_name=[screen_name]')
id fromIntToNum = [NSNumber numberWithInteger: friID];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"159462573", @"user_id", nil];
// Setup the request
twitterRequest = [[TWRequest alloc] initWithURL:followingURL
parameters:parameters
requestMethod:TWRequestMethodGET];
// This is important! Set the account for the request so we can do an authenticated request. Without this you cannot get the followers for private accounts and Twitter may also return an error if you're doing too many requests
[twitterRequest setAccount:theAccount];
// Perform the request for Twitter friends
[twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (error) {
/*
// deal with any errors - keep in mind, though you may receive a valid response that contains an error, so you may want to look at the response and ensure no 'error:' key is present in the dictionary
NSLog(@"%@",error);*/
} else {
/*NSError *jsonError = nil;
// Convert the response into a dictionary
NSDictionary *twitterGrabbedUserInfo = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONWritingPrettyPrinted error:&jsonError];
// Grab the Ids that Twitter returned and add them to the dictionary we created earlier
NSLog(@"%@", [twitterGrabbedUserInfo objectForKey:@"screen_name"]);*/
}
}];
我分開我的代碼失敗就行了...
什麼可能會導致這Twitter的API問題?
下面一行導致崩潰:::
[twitterRequest performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse, NSError *error) {
我有時也會出現此錯誤:
[__NSCFNumber credentialForAccount:]: unrecognized
更新:我註釋掉的處理程序和我做了TwitterRequest和伊娃,但它仍然崩潰...
哪條線產生碰撞? – Vladimir 2012-07-24 14:30:38
[twitterRequest performRequestWithHandler:^(NSData * responseData, NSHTTPURLResponse * urlResponse,NSError * error){ – 2012-07-24 14:31:14