Swift 4 AppDelegate线程1:断点1.2错误

时间:2018-05-16 03:26:14

标签: ios swift xcode

**我已经遇到了类似的问题,但还没能解决问题..只有在我添加任何标签或图像视图时才会出现错误,但是当我更改背景颜色时工作正常

任何帮助都将受到极大的赞赏(从晚上开始坚持这一点)。提前谢谢!

嘿伙计们我正在尝试构建一个简单的ios项目(相当新的swift),每当我尝试在模拟器中运行我的代码时,我总会得到如下图所示的错误。到目前为止,我在这个项目中所做的就是添加标签并更改背景但是当我运行代码时它显示成功但无法在任何模拟器中运行并指向appdelegate.swift文件Appdelegate Thread 1: breakpoint 1.2 error

这是我的代码:

AppDelegate.swift

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }


}

viewcontroller.swift

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

在我的main.storyboard中,我刚添加了一个标签并更改了背景颜色

2 个答案:

答案 0 :(得分:1)

您认为这是一个错误但它实际上是一个调试断点。你无意中设置了一个容易做到的断点。如果该行为绿色,则表示断点但不表示错误。

要删除任何断点,请单击屏幕截图中显示的蓝色箭头。删除断点后,代码应该正常运行。

答案 1 :(得分:0)

好吧,图片中只显示debugging breakpoint如果您添加的breakpoints完全没问题。

  1. 删除所有断点并尝试运行该程序并检查它是否仍然停在那里。
  2. 如果您添加了exceptional breakpoint,请执行以下图片中显示的内容
  3. has been proposed