简体   繁体   中英

App Crashes on AppDelegate Class Declaration with EXC_BAD_ACCESS CODE 1 on iOS 9.1/9.2

I installed XCode 7.1 and 7.2 to update my app for iOS 9.1 and 9.2 respectively, but each time I run the app on simulators or devices the app crashes on the AppDelegate's class declaration as shown below. However, I have also XCode 7.0 and when I run my app on iOS 9.0 it works fine without any issue !.

The problem even if I compile the app for iOS 9.0 it would crashes on any device running iOS 9.1 or 9.2, I tried to change the initial view controller to be a simple plain one but it seems that it never reaches the point of loading view controllers and never reaches the beginning of func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool .

It seems that Apple did something with iOS 9.1 & 9.2. The app is written in swift, I enabled NSZombie and breakpoints to catch exceptions but I get no clue from the logs.

Debug Navigator:-

在此输入图像描述

AppDelegate Class Declaration

在此输入图像描述

That happens to me almost every time in new versions of Xcode/Swift/iOS. When I have had this problem I have erased that line and written it again.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 

This happens when you have not set you variable types correctly. Check how you declare them. In my case i was trying to access a Bool as UIColor.

I've generally had this happen when there is a storyboard problem. For example, an error in:

storyboard.instantiateController(withIdentifier: "FooView")

Try putting breakpoints around controllers that are being loaded around where you are crashing to see if that's the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM