Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone TWRequest中EXC_BAD_请求存在问题_Iphone_Objective C_Ios_Ipad_Twrequest - Fatal编程技术网

Iphone TWRequest中EXC_BAD_请求存在问题

Iphone TWRequest中EXC_BAD_请求存在问题,iphone,objective-c,ios,ipad,twrequest,Iphone,Objective C,Ios,Ipad,Twrequest,我有下面的代码,在执行请求时它总是让我崩溃,你知道吗 NSString *responseBody = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"Response body is %@", responseBody); NSDictionary

我有下面的代码,在执行请求时它总是让我崩溃,你知道吗

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);
         }];
更新: 打开NSZombieEnabled会让我

*** -[ACAccountStore typeForAccount:]: message sent to deallocated instance 0x7199c70

这里没有你称之为accountstore typeForAccount的地方。但是会计商店不见了。查看AcAccount文档,没有特殊的初始值设定项,因此您的代码中可能有如下内容:

static ACAccountStore* accountStore = [[[ACAccountStore alloc] init] autorelease];
然后在请求完成时,对象已被操作系统清除,但您的accountStore仍然指向旧的、现在悬空的指针。指针可以是“静态”或“全局”,也可以是其他静态或全局对象的成员


在代码中查找accountstore。

在某个地方,您可以将accountstore类型称为account。但是会计商店不见了。查看AcAccount文档,没有特殊的初始值设定项,因此您的代码中可能有如下内容:

static ACAccountStore* accountStore = [[[ACAccountStore alloc] init] autorelease];
然后在请求完成时,对象已被操作系统清除,但您的accountStore仍然指向旧的、现在悬空的指针。指针可以是“静态”或“全局”,也可以是其他静态或全局对象的成员


在代码中查找accountstore。

您的错误看起来与您的问题完全不同。ACAccountStore类中存在错误。访问、操作和存储帐户(ACAccountStore)时,请检查保留计数。我认为您首先释放了内存,并且在何处使用了一些内存

您的错误看起来与您的问题完全不同。ACAccountStore类中存在错误。访问、操作和存储帐户(ACAccountStore)时,请检查保留计数。我认为您首先释放了内存,并且在何处使用了一些内存

尝试设置一个异常断点,然后准确地发布它在哪一行上中断以及引发了什么异常。请将断点放在块(//执行请求)代码上,并找出哪一行给您带来了问题。尝试设置一个异常断点,然后准确地发布它在哪一行上中断以及引发了什么异常。请将断点放在块(//执行请求)代码上,并找出哪一行给您带来了问题。