Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 - Some segues not working anymore

Tags:

ios

swift

xcode7

I upgraded my Swift app to Xcode 7 / Swift 2.0 and now suddenly certain segues in my app no longer work.

I have a segue popping up a "Check In" modal and it works perfectly, but then I have another segue popping up a "Check Out" modal that's near identical and it doesn't launch and the app is frozen.

I re-created the segue from scratch, confirmed that it is identical to the "Check In" one, and it still doesn't work.

I also, instead, tried launching a blank view instead of my Check Out modal and it works fine.

There are no errors, it just freezes, I did confirm that the "prepareForSegue" portion is being called correctly but the "viewDidLoad" portion of my modal is not being invoked.

FYI, I have auto-layout turned off.

like image 421
William T. Avatar asked Sep 18 '15 19:09

William T.


3 Answers

Does your "Check Out" modal have a UITextView? If it does, then there's a bug in Xcode 7 / iOS9 where you cannot launch a modal (or any root view) that contains a UITextView if you have set a default text value in storyboard.

A work around is to make sure your UITextView in storyboard is either blank or has the default Lorem Ipsem value and instead, set the text programmatically in code on viewDidLoad.

Hopefully this bug will be fixed soon.

like image 195
Travis M. Avatar answered Nov 08 '22 02:11

Travis M.


I suspect there is infinite loop somewhere in you "Check Out" controller code. Try pausing app in debugger after presenting controller (when it freezes) and check stacktrace. If it doesn't help, try commenting-out code line-by-line in viewDidLoad and viewWillAppear to find line causing freeze.

like image 35
glyuck Avatar answered Nov 08 '22 01:11

glyuck


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 have to give a storyboard id in your view and normally it's working.

like image 1
HarryMlk Avatar answered Nov 08 '22 00:11

HarryMlk