iphone - got EXC_BAD_ACCESS when I Cancel a Asynchronous web request by using ASIHTTPRequest -


I have no problem running the sample code below in the iPhone simulator, but when I run it in the iPhone, I always When I call [cancel asiRequest], get an EXC_BAD_ACCESS Anybody can help? Thank you.

ASIHTTPRVEVEST * ASIRIEST; - (IBAction) request1 {NSLog (@ "Request Request"); [Send send quote]; } - (IBAction) cancel1 {NSLog (@ "request caceling"); If (ACRYAST) [ASIRC CANCELED]; } - (zero) Send request {asiRequest = [ashiRTPR request request with url: [NSUr URL: YouthString: @ "http://maps.google.com/"]]; [Delegate Set AsiRequest: self]; [AsiRequest startAsynchronous]; } - (zero) Requested: (ASIHTPPRQUEQUEST *) REQUEST {NSLOG (@ "request"); AsiRequest = nil; } - (Zero) RequestFell: (ASIHTPPREEstei *) Request {NSLog (@ "Request Error =% @", [Request Error]); AsiRequest = nil; }

After checking the API, I think I should not release it in request, such an issue or request

Can you release?

  - (zero) Cancel {#if DEBUG_REQUEST_STATUS NSLog (@ "Request has been canceled:% @", manually); #endif [[locked yourself] locked]; If ([self has been canceled]] [self full]] [[unlocked lock]]]; Return; } [Self-Failure Error: ASIRIST Coined Arrayer]; [Self set full: yes]; [Self cancel]; [[Unlock itself] unlocked]; // We will tell the operation to cancel after unlocking, because this request can be canceled and then the NSLock will log an error [super cancel]; }  

You need to retain your ASIHTTPRequest, as the facility is through the use of the constructor The request was automated, so it must be maintained to keep it near the end of the current run loop. Also, keep in mind that you do not need it to check that asiRequest is not in zero to cancel1: : sending a message to zero Not even there, and it has no adverse effects.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -