App works on iPhone 3GS but crashes on iPhone 3G at launch
I developed an app with Xcode 3.2.3 and iPhone SDK 4.0. It works fine on both iPhone 3开发者_开发百科GS and 3G if I run it directly within Xcode.
However, if I download and install the app from App Store, it crashes at the launch screen for iPhone 3G and iPod touch 3G. But it works on iPhone 3GS with OS 3.1.3 or iOS 4.0.
The device log shows the following:
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x00000001, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 Dove 0x000762aa +[TTNavigator navigator] (TTNavigator.m:59)
1 Dove 0x000035ce -[Around01AppDelegate applicationDidFinishLaunching:] (Around01AppDelegate.m:85)
2 UIKit 0x00004e88 -[UIApplication _performInitializationWithURL:sourceBundleID:] + 540
3 UIKit 0x00004a60 -[UIApplication _runWithURL:sourceBundleID:] + 576
4 UIKit 0x00055df8 -[UIApplication handleEvent:withNewEvent:] + 1516
5 UIKit 0x00055634 -[UIApplication sendEvent:] + 60
6 UIKit 0x0005508c _UIApplicationHandleEvent + 4528
7 GraphicsServices 0x00005988 PurpleEventCallback + 1044
8 CoreFoundation 0x00057524 CFRunLoopRunSpecific + 2296
9 CoreFoundation 0x00056c18 CFRunLoopRunInMode + 44
10 UIKit 0x00003c00 -[UIApplication _run] + 512
11 UIKit 0x00002228 UIApplicationMain + 960
12 Dove 0x00003086 main (main.m:26)
13 Dove 0x00002ec8 start + 44
You have the wrong architecture setting in your Release configuration. If you want to deploy on a 3G and 2008 iPod touch, you must create instructions for arm6 and arm7. You are probably creating an optimized arm7 binary only. Add the arm6 architecture to your Release configuration and try again.
I figured it out by referring to info on this page: http://useyourloaf.com/blog/2010/4/21/xcode-build-active-architecture-only.html
If you are using any third-party libraries, should recompile all of them using the same project settings as you used on your own project.
In my case, Base SDK: iOS 4.0, Deployment Target: 3.0, and make sure you uncheck "Build Active Architecture Only"
The start-up crash is a result of the wrong architecture for the dependencies and your project. I had a similar issue with my project. My project was running fine on Debug iPhone 3G, and crashing Release iPhone 3G. However, it ran fine on iPad and iPhone 4 in Debug/Release.
I had a library that I was building with Debug (Standard armv6, armv7), and the Release (Optimized armv7). The main project was building with Standard (armv6, armv7) for Debug/Release. This architecture mismatch caused the crash in Release on iPhone 3G. The reason I had this crash is that iPhone 3G must use armv6, but iPhone 4 and iPad can use armv7.
run
Running…
[Switching to thread 11523]
[Switching to thread 11523]
sharedlibrary apply-load-rules all
continue
Program received signal: “EXC_BAD_ACCESS”.
warning: check_safe_call: could not restore current frame
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
(gdb)
To fix the issue change the iPhone library Target's "Architectures" to use Standard (armv6, armv7) for "All Configurations".
Hey, you've mentioned using Facebook three20 library. We had exactly the same problem - application crashing with EXC_BAD_ACCESS only in appstore distribution | release configuration, ONLY on iPhone 3G / iPod touch 2G, but working perfectly on iPhone 3GS and iPad. It turned out that we were using JSON library built-in three20, and that library was the cause. Problem solved by downloading new version of JSON library (apparently with this error fixed) in our case.
精彩评论