Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Contacts App working on iPad but not iPhone -> Thread 1: Breakpoint 1.1 in AppDelegate.swift file

Hi,

iPad is displaying everything correctly, but iPhone 8 is not displaying the list of names or nav bar. In my app delegate file, the compiler is showing a thread 1: breakpoint 1.1 message inside the splitViewController method.

Can anyone please explain where I am going wrong here? And also what a breakpoint is?

Here's my AppDelegate.swift file...

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let splitViewController = window!.rootViewController as! UISplitViewController
        let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
        navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
        splitViewController.delegate = self
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
    }

    func applicationWillTerminate(_ application: UIApplication) {
    }

    // MARK: - Split view

    func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController:UIViewController, onto primaryViewController:UIViewController) -> Bool {
        guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false } // Thread 1: Breakpoint 1.1 
        guard let topAsDetailController = secondaryAsNavController.topViewController as? ContactDetailController else { return false } 
        if topAsDetailController.contact == nil {
            return true
        }
        return false
    }

}

Thanks a lot!!

Michelle

2 Answers

Michael Hulet
Michael Hulet
47,913 Points

A "breakpoint" is a point you can set where the debugger will pause your code so you can poke around and inspect the value of variables and invoke methods and such. It sounds like your code isn't crashing, but you set a breakpoint that's pausing your code. You can disable it by clicking on it. It should be a blue arrow-looking sort of thing in the bar that shows the line number for your code on the line where it's stopping

Thanks Michael!!