user3723418
user3723418

Reputation:

Thread 1 Breakpoint 1.2 - Swift Xcode 6 beta 2

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.

image

Upvotes: 0

Views: 3382

Answers (4)

Rezaul Karim
Rezaul Karim

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

rdf_rdfsg
rdf_rdfsg

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

Rupom
Rupom

Reputation: 439

Search for Deactivate Breakpoints from Debug Menu , hope it will solve the problem

Upvotes: 1

Ah Ryun Moon
Ah Ryun Moon

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

Related Questions