我有下面的代碼,它總是讓我崩潰時執行請求,任何想法?問題與TWRequest中的EXC_BAD_REQUEST
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"Response body is %@", responseBody);
NSDictionary *accessTokenRequestParams = [[NSMutableDictionary alloc] init];
[accessTokenRequestParams setValue:CONSUMER_KEY forKey:@"x_reverse_auth_target"];
[accessTokenRequestParams setValue:responseBody forKey:@"x_reverse_auth_parameters"];
NSURL *url2 = [NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"];
TWRequest * accessTokenRequest = [[TWRequest alloc] initWithURL:url2 parameters:accessTokenRequestParams requestMethod:TWRequestMethodPOST];
if (selectionIndex != -1)
[accessTokenRequest setAccount:[self.twitterACAccounts objectAtIndex:selectionIndex]];
// execute the request
[accessTokenRequest performRequestWithHandler:
^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *responseStr =
[[NSString alloc] initWithData:responseData
encoding:NSUTF8StringEncoding];
NSLog(@"The user's info for your server:\n%@", responseStr);
}];
UPDATE: 打開NSZombieEnabled給我
*** -[ACAccountStore typeForAccount:]: message sent to deallocated instance 0x7199c70
這是沒有被發現
嘗試設置一個異常斷點,然後張貼正確的是哪一行以及拋出了什麼異常。 – 2012-01-09 18:57:08
請在塊上放置斷點(//執行請求)代碼,並找出哪條線會給你帶來問題。 – AAV 2012-01-09 18:59:27
看到我上面的編輯 – adit 2012-01-09 19:58:46