NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:requestStr]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSURLResponse *response;
NSError *error;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if(error) {
NSLog(@"error: %@", [error localizedDescription]);
}
After hours of debugging we could narrow it down to the line of code that initialises the NSError. Setting it to nil did remove the crash. So make sure your code looks like this:
NSError *error = nil;
We are currently investigating more issues we have with code that ran perfectly fine in 3.x and now starts crashing with iOS4. The above line fixed approximately 80% of our problems.
Good luck making your apps ready for iOS4.
5 comments:
Thank you very much, you are a hero! I had the same, I tried to find the reason with debugging, but even the xcode debugger died because of the missing initialization of NSError variable.
Thanks for posting this! I've been beating my head up for 2 hours on this one....
This saved me quite a lot of time, Thanks so much!
Am using Titanium SDK. Found similar code in Classes/ASI/ASIHTTPRequest.h
However, initialising it to nill simply broke up the compile :!
Any help?
regards
Anshu Prateek
This is one of the knowledgeable and good post.I like your blog talent.Thanks for your support.
Android app developers
Post a Comment