Reputation:
I have code for a splash screen that then goes into the main login screen. But it is not switching, it is giving me a Thread 1 Breakpoint 1.2
error.
here is the code:
func switchScreen() {
let mainStoryboard = UIStoryboard(name: "Storyboard", bundle: NSBundle.mainBundle())
let vc : UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("vcMainLogin") as UIViewController // this is the line giving the error
self.presentViewController(vc, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "switchScreen", userInfo: nil, repeats: false)
// Do any additional setup after loading the view.
}
I have set the Storyboard ID to the same as the class name, but still it gives me this, and in the output: (lldb)
only.
Upvotes: 0
Views: 3382
Reputation: 1349
You may have accidentally set a breakpoint without noticing. You have to disable all of your app breakpoints.
You can disable all your breakpoint by click, -> Debug menu -> deactivate breakpoints
Upvotes: 2
Reputation: 11
So, I just had this situation and it wasn't with a breakpoint that I had explicitly set -- it was caused by an "All Exceptions" breakpoint and didn't seem to be happening in my code, per se, but in some sceneKit code, specifically when I was setting a SCNMaterial's diffuse.contents to a .png file.
The SceneKit code wasn't throwing an explicit error, and everything proceeded fine, but I was consistently breaking on this particular png (& not on any others I was using in the same manner)
I regenerated the png in Photoshop (using compressed/non-interlaced) and everything worked fine, no more errors.
The trick here is, if you really don't have a breakpoint explicitly set, look up the stack and see what might have triggered the error -- not all of the library code gives a nice clean diagnostic when it encounters an exception
Upvotes: 0
Reputation: 439
Search for Deactivate Breakpoints from Debug Menu , hope it will solve the problem
Upvotes: 1
Reputation: 370
Try putting the following code in ViewDidAppear instead of ViewDidLoad
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "switchScreen", userInfo: nil, repeats: false)
The presenting controller must be fully loaded and appear before you can segue to the presented controller.
Upvotes: 0