ios - Swift 4 AppDelegate 线程 1 : breakpoint 1. 2 错误

标签 ios swift xcode

** 我遇到过类似的问题,但未能解决问题..错误仅在我添加任何标签或 ImageView 时发生,但在我更改背景颜色时工作正常

任何帮助将不胜感激(从晚上开始就一直坚持下去)。提前致谢!

嘿伙计们,我正在尝试构建一个简单的 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 中,我刚刚添加了一个标签并更改了背景颜色

最佳答案

您假设这是一个错误,但它实际上是一个调试断点。您无意中设置了一个很容易做到的断点。这条线是绿色的,它表示断点但不表示错误。

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

关于ios - Swift 4 AppDelegate 线程 1 : breakpoint 1. 2 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50362046/

相关文章:

ios - UITabbar 图像上下移动

swift - 从 String 创建 DateComponents/NSDateComponents ,反之亦然

objective-c - NSMutableArray 作为实例变量总是 null

ios - stringWithFormat、dateFromString 和 stringFromDate 不起作用

ios - 如何在 Swift 中将数据从父 View Controller 多次传递到容器 VC 子 Controller ?

ios - Swift:通过 UIView 识别滚动

Xcode 10 在插入 C++ 的包含名称时中断自动完成,有什么解决方法吗?

ios - 在运行时知道您正在 IBDesignable 中运行

iphone - 在 iPhone 应用程序升级上部署 sqlite DB

ios - 启用/禁用按钮,用于验证在文本字段中输入的电话号码