iOS ASIFormDataRequest崩溃

iOS ASIFormDataRequest崩溃,ios,exc-bad-access,asiformdatarequest,Ios,Exc Bad Access,Asiformdatarequest,我有一个注册方法,可以点击API注册用户并返回帐户信息。一切正常,但在我的注册视图控制器中,注册成功后,我会弹出注册视图。一旦我弹出“注册”视图,我就可以在下面的行中访问EXC_BAD_。注意-这只发生在电话上。在模拟器中,这不会发生。不知怎么的,这似乎是个时间问题,但我想不出来。例如,如果我在[_CompletionHandlerSignupRelease]上放置了一个断点;然后它每次都能工作 以下是我的DataAccessor类中的CreateCount方法: _completionHand

我有一个注册方法,可以点击API注册用户并返回帐户信息。一切正常,但在我的注册视图控制器中,注册成功后,我会弹出注册视图。一旦我弹出“注册”视图,我就可以在下面的行中访问EXC_BAD_。注意-这只发生在电话上。在模拟器中,这不会发生。不知怎么的,这似乎是个时间问题,但我想不出来。例如,如果我在[_CompletionHandlerSignupRelease]上放置了一个断点;然后它每次都能工作

以下是我的DataAccessor类中的CreateCount方法:

_completionHandlerSignUp = [handler copy];

the normal request code would be here

[request setCompletionBlock:^
 {
     int statusCode = request.responseStatusCode;

     NSDictionary *json = [request.responseString JSONValue];
     NSString *status = [json valueForKeyPath:@"status"];
     NSLog(@"API JSON %@", request.responseString);

     myAccount.statusCode = statusCode;

     if(statusCode == 200)
     {
         myAccount.status = status;
         myAccount.error = @"";
         myAccount.firstName = firstName;
         myAccount.lastName = lastName;
         Credentials *myCredentials = [[Credentials alloc] init];
         myCredentials.emailAddress = userName;
         myCredentials.passWord = passWord;
         myAccount.credentials = myCredentials;

         [myCredentials release];
     }
     else if(statusCode == 403)
     {
         NSString *error = [json valueForKeyPath:@"error"];
         myAccount.status = status;
         myAccount.error = error;
         NSLog(@"API Error %@",error);
     }

     NSLog(@"TEST - Sending Account Response ");
     _completionHandlerSignUp(myAccount);

     NSLog(@"TEST - DEALLOCATING OBJECTS ");

    [_completionHandlerSignUp release];  <--**EXC_BAD_ACCESS HAPPENS HERE**
    _completionHandlerSignUp = nil;

     }];
\u completionHandlerSignUp=[handler copy];
正常的请求代码在这里
[请求setCompletionBlock:^
{
int statusCode=request.responseStatusCode;
NSDictionary*json=[request.responseString JSONValue];
NSString*状态=[json valueForKeyPath:@“状态”];
NSLog(@“API JSON%@”,request.responseString);
myAccount.statusCode=状态代码;
如果(状态代码==200)
{
myAccount.status=状态;
myAccount.error=@;
myAccount.firstName=firstName;
myAccount.lastName=lastName;
凭证*myCredentials=[[Credentials alloc]init];
myCredentials.emailAddress=用户名;
myCredentials.passWord=密码;
myAccount.credentials=我的凭证;
[myCredentials release];
}
否则如果(状态代码==403)
{
NSString*error=[json valueForKeyPath:@“error”];
myAccount.status=状态;
myAccount.error=错误;
NSLog(@“API错误%@”,错误);
}
NSLog(@“测试-发送帐户响应”);
_completionHandlerSignUp(我的帐户);
NSLog(@“测试-释放对象”);

[\u completionHandlerSignUp release];打开僵尸对象以获取有关EXE\u BAD\u访问错误的更多详细信息。应该告诉您有关该对象的一些信息,该对象预期会出现在那里。这通常意味着您在执行代码时过早释放了对象指针

打开僵尸:


删除此[\u completionHandlerSignUp发行版]时会发生什么情况行?

Hmm,出于某种原因,我曾在启用僵尸的情况下让它在模拟器中崩溃过一次,罪魁祸首是ASIFormDataRequest GraphicsServices,但实际上没有其他信息:/n您能发布启用僵尸时收到的完整错误消息吗?添加了它,对格式感到抱歉,但不确定如何在SOfigured中显示它,dumb和往常一样是一个简单的错误:)顺便说一句,如果你使用的是iOS 5,使用ARC可以省去很多麻烦。你必须为一些ASIHttpRequest类添加编译器标志,但这是非常值得的。我确实让僵尸运行了,看看上面。而且,当我删除这一行时,它的行为也没有什么不同。
DataAccessor *dataAccessor = [[DataAccessor alloc] init];

        [dataAccessor createAccount:[Utilities getDeviceUDID] user:txtEmail.text password:txtPassword.text firstname:txtFirstName.text lastname:txtLastName.text  completion:^(Account *myAccount)
        {
            [dataAccessor release]; 

            if(myAccount != NULL)
            {
                NSLog(@"Status: %@", myAccount.status);
                NSLog(@"Error: %@", myAccount.error);

                if(myAccount.statusCode == 200)  //handle successful transaction
                {

                    [Preferences signInUser:myAccount.credentials.emailAddress password:myAccount.credentials.passWord];

                    [self popViewController];  **<<<<If I remove this, THERE IS NO CRASH******
                }
                else if(myAccount.statusCode == 403)
                {
                    //todo - handle error
                }
            }


            [self finalUpdate];
        }];

- (void) popViewController
{
    NSLog(@"TEST - Popping View Controller ");

    CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
    transition.subtype = kCATransitionFromBottom; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
    //  MainSelectionMenu *myViewController = [[MainSelectionMenu alloc] initWithNibName:@"MainSelectionMenu" bundle:nil];
    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    [[self navigationController] popViewControllerAnimated:NO];
}
- Address Category Event Type RefCt Timestamp Size Responsible Library Responsible Caller 0 0x11035a00 ASIFormDataRequest Malloc 1 00:16.125.952 1024 Saveology +[ASIFormDataRequest requestWithURL:] 1 0x11035a00 ASIFormDataRequest Autorelease 00:16.126.025 0 Saveology +[ASIFormDataRequest requestWithURL:] 2 0x11035a00 ASIFormDataRequest Autorelease 00:16.126.026 0 Saveology -[SaveologyDealsDataAccessor createDealsAccount:user:password:firstname:lastname:divisionid:completion:] 3 0x11035a00 ASIFormDataRequest Retain 2 00:16.126.179 0 Foundation NSRecordAllocationEvent 4 0x11035a00 ASIFormDataRequest Retain 3 00:16.126.196 0 Foundation NSRecordAllocationEvent 5 0x11035a00 ASIFormDataRequest Release 2 00:16.126.266 0 Foundation NSRecordAllocationEvent 6 0x11035a00 ASIFormDataRequest Release 1 00:16.126.267 0 Foundation NSRecordAllocationEvent 7 0x11035a00 ASIFormDataRequest Retain 2 00:16.127.268 0 Foundation NSRecordAllocationEvent 8 0x11035a00 ASIFormDataRequest Retain 3 00:16.127.302 0 Foundation NSRecordAllocationEvent 9 0x11035a00 ASIFormDataRequest Release 2 00:16.127.332 0 Foundation NSRecordAllocationEvent 10 0x11035a00 ASIFormDataRequest Retain 3 00:16.128.711 0 Foundation NSRecordAllocationEvent 11 0x11035a00 ASIFormDataRequest Release 2 00:16.128.771 0 Foundation NSRecordAllocationEvent 12 0x11035a00 ASIFormDataRequest Retain 3 00:16.129.880 0 Foundation NSRecordAllocationEvent 13 0x11035a00 ASIFormDataRequest Retain 4 00:16.129.889 0 Foundation NSRecordAllocationEvent 14 0x11035a00 ASIFormDataRequest Release 3 00:16.129.893 0 Foundation NSRecordAllocationEvent 15 0x11035a00 ASIFormDataRequest Release 2 00:16.129.912 0 Foundation NSRecordAllocationEvent 16 0x11035a00 ASIFormDataRequest Retain 3 00:16.309.250 0 Foundation NSRecordAllocationEvent 17 0x11035a00 ASIFormDataRequest Retain 4 00:16.310.289 0 Foundation NSRecordAllocationEvent 18 0x11035a00 ASIFormDataRequest Release 3 00:16.310.396 0 Foundation NSRecordAllocationEvent 19 0x11035a00 ASIFormDataRequest Release 2 00:16.310.640 0 Foundation NSRecordAllocationEvent 20 0x11035a00 ASIFormDataRequest Retain 3 00:16.310.775 0 Foundation NSRecordAllocationEvent 21 0x11035a00 ASIFormDataRequest Retain 4 00:16.310.776 0 Foundation NSRecordAllocationEvent 22 0x11035a00 ASIFormDataRequest Release 3 00:16.310.789 0 Foundation NSRecordAllocationEvent 23 0x11035a00 ASIFormDataRequest Release 2 00:16.310.807 0 Foundation NSRecordAllocationEvent 24 0x11035a00 ASIFormDataRequest Retain 3 00:16.311.443 0 Foundation NSRecordAllocationEvent 25 0x11035a00 ASIFormDataRequest Retain 4 00:16.311.469 0 Foundation NSRecordAllocationEvent 26 0x11035a00 ASIFormDataRequest Retain 5 00:16.311.491 0 Foundation NSRecordAllocationEvent 27 0x11035a00 ASIFormDataRequest Retain 6 00:16.311.496 0 Foundation NSRecordAllocationEvent 28 0x11035a00 ASIFormDataRequest Release 5 00:16.311.501 0 Foundation NSRecordAllocationEvent 29 0x11035a00 ASIFormDataRequest Release 4 00:16.311.546 0 Foundation NSRecordAllocationEvent 30 0x11035a00 ASIFormDataRequest Release 3 00:16.311.557 0 Foundation NSRecordAllocationEvent 31 0x11035a00 ASIFormDataRequest Release 2 00:16.311.563 0 Foundation NSRecordAllocationEvent 32 0x11035a00 ASIFormDataRequest Release 1 00:16.313.736 0 Foundation NSRecordAllocationEvent 33 0x11035a00 ASIFormDataRequest Release 0 00:16.320.573 0 Foundation NSRecordAllocationEvent 34 0x11035a00 ASIFormDataRequest Zombie -1 00:16.320.964 0 GraphicsServices GSEventRunModal