问题
EDIT
This problem is related to ASIHTTPRequest. When I remove the ASIHTTPRequest async block, the app does not crash on my device any more. I can run the ASIHTTPRequest code on my device, loaded from Xcode fine. It's just when I upload the archive from TestFlight and try to run it that it crashes. The device crash log shows:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000058 Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed:
All of a sudden, today, after 20 successful ad hoc builds and runs uploaded via TestFlight, my last 3 AD Hoc successfully upload to TestFlight but crash on my test device.
These builds run perfectly when coming off of Xcode onto the device. In fact, i can quit the app, disconnect my device from Xcode and the app runs fine and like I said, I am able to successfully upload those builds to TestFlight with my AD Hoc distribution profile. But when I go to install and run, the app executes up to the launch image and then crashes.
All of the settings in Xcode have remained untouched so I am wondering if you know what could be causing this?
It sure sounds like my AD Hoc distribution profile, since that is the only difference between when I build and run from Xcode VS from TestFlight but it's weird that it just stopped working...
Anyone else have that issue?
What should I try next?
回答1:
I had this exact same problem, it worked flawlessly when built directly from XCode but, when deployed through AD Hoc, it'd crash every time. I'm not sure why but as it turns out the problem is with the blocks of ASIHTTPRequest
completion and failure. Here is how I worked around it.
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDidFinishSelector:@selector(completedImg:)];
[request setDidFailSelector:@selector(failedImg:)];
[request setDelegate:self];
[request startAsynchronous];
Note* I only had this crash when downloading videos (it works fine with documents and images for some reason).
来源:https://stackoverflow.com/questions/12099211/ad-hoc-builds-crashing-on-device-only-asihttprequest