Xcode 7 - Some sessions no longer work

I upgraded my Swift application to Xcode 7 / Swift 2.0, and now unexpectedly some changes in my application no longer work.

I have a segue that gives the "Check In" mod and it works fine, but then I have another segue that gives the "Check Out" mod, which is almost identical and it does not start, and the application is frozen.

I re-created segue from scratch, confirmed that it is identical to "Check In", and it still does not work.

Instead, I tried to start an empty view instead of my Check Out mod, and it works great.

There are no errors, it just freezes, I confirmed that the "prepareForSegue" part is called correctly, but the "viewDidLoad" part of my module is not called.

FYI, I turned off auto-linking.

+7
ios swift xcode7
source share
5 answers

Does your mod have a β€œCheck Out” UITextView? If so, then there is an error in Xcode 7 / iOS9 where you cannot run a modal (or any root view) that contains a UITextView if you set the text value to the default in the storyboard.

Work on making sure that your UITextView in the storyboard is either empty or has the default Lorem Ipsem, and instead programmatically code the code in viewDidLoad.

I hope this error will be fixed soon.

+8
source share

I suspect your Check Out code has an infinite loop. Try pausing the application in the debugger after the controller submits (when it freezes) and check stacktrace. If this does not help, try commenting out the code line by line in viewDidLoad and viewWillAppear to find the line causing the freeze.

+1
source share

I had this problem, try with this

 dispatch_async(dispatch_get_main_queue(), { () -> Void in let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("Storyboard Id") self.presentViewController(viewController, animated: true, completion: nil) }) 

You just need to specify the storyboard identifier in your view and it usually works.

+1
source share

My app worked great in iOS8. His stream:

VC: View Controller, NVC: navigation view controller, ER: built-in root relationship between NVC and VC, PS: Push Segue, PG: software presentation

NVC1 --- (ER) β†’ VC1 --- (PS) β†’ NVC2 --- (ER) β†’ VC2 etc.

The problem was that VC1- (PS) β†’ NVC2 segue did not work, there was no freezing. Executed vc1.prepareForSegue (), but VC2 was not introduced. I experimented and found that I did not have a problem with the UITextView mentioned here. Following the breadcrumbs below, I made it work after several hours of trying in the following order (code at the end): NVC1 --- (ER) β†’ VC1 --- (PG) β†’ VC2

Here are the steps: As mentioned in the Segue issue in iOS9 , several NVCs don't match the style (shame on Apple by suddenly throwing what is actually recommended in your online tutorial and causing applications to break!). So I modified NVC1 --- (ER) β†’ VC1 - (PS) β†’ VC2, and VC2 is still built into NVC2. I got errors similar to fooobar.com/questions/15699 / .... So, I started making the transition programmatically and after solving the present and the problems with the ViewController , which leads to the message "tried to push modally on active view controller" , and then the ViewController had lifecycle problems that led to the messages "Unbalanced calls to begin/end appearance transactions" , I got the following code. Based on this experience, I really think that Apple should have left only one thing in the Xcode7 / iOS9 update.

  //*********** VC1.swift. A translation of working code class VC1:UIViewController{ private var viewController2:VC2? private var showVC2: Bool = false override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) if(showVC2) { showVC2 = false self.pushVC2() } }//viewWillAppear private var info:String? // info from incoming user action. @IBAction unwindToVC1FromUserAction(incomingSegue: UIStoryboardSegue?) { // Do app-specific stuff to get info from incomingSegue and // store in self.info variables. let myboard: UIStoryBoard = self.storyboard!; self.viewController2 = myboard.instantiateViewControllerWithIdentifier( "VC2 Storyboard ID") as! VC2 self.prepareVC2() // Pass info to VC2.info, stuff you would have done in prepareForSegue showVC2= true } //unwind private func prepareVC2() { self.viewController2.info = self.info // etc.. } private func pushVC2() { self.navigationController!.pushViewController(viewController2!, animated:false) } } //class 
+1
source share

I had it, but it was not of the above. My segue call ended up inside a block. When I moved the call to the main thread, I saw that I had an NSUnknownKeyException error in the new View Controller. Being inside the block seemed to prevent the error from registering in Xcode, so the application just appeared without any errors.

Once this was resolved, the source code worked fine.

0
source share

All Articles