Xcode:如何修复线程 5:EXC_BREAKPOINT(代码=1,子代码=0x10025c76c)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35860313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:37:25  来源:igfitidea点击:

Xcode: how to fix Thread 5: EXC_BREAKPOINT (code=1, subcode=0x10025c76c)

iosiphonexcodeswift2

提问by ShingHung

when I click the btnLogin in the iPhone the xCode was displayed the error:

当我单击 iPhone 中的 btnLogin 时,xCode 显示错误:

Thread 5: EXC_BREAKPOINT (code=1, subcode=0x10025c76c)

线程 5:EXC_BREAKPOINT(代码=1,子代码=0x10025c76c)

this is my code

这是我的代码

@IBOutlet weak var abc: UILabel!

   ...

@IBAction func btnLogin(sender: UIButton) {

    var jsonResult = AnyObject?()

    let urlAsString = "lifewinner2015.dlinkddns.com/SERVER/user?function=login&username=Shing&password=123456789"

    let url = NSURL(string: urlAsString)

    let urlSession = NSURLSession.sharedSession()

    let jsonQuery = urlSession.dataTaskWithURL(url!, completionHandler: {data, reponse, error -> Void in
        if (error != nil) {
            print("error")
        }

        do {
            jsonResult = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments) as! NSDictionary
            let jsonAbc: String! = jsonResult!["return"] as! String

            dispatch_async(dispatch_get_main_queue(), {
                self.abc.text = jsonAbc
            })
        } catch let err as NSError! {
            if (err != nil) {
                print("JSON Error")
            }
        }
    })
    jsonQuery.resume()

}
  1. run the app on the iPhone (9.2 Version)
  2. click the Login button
  3. Xcode will display the error(Photo 1)

    Photo 1: http://i.stack.imgur.com/loErxm.jpg

  1. 在 iPhone 上运行应用程序(9.2 版本)
  2. 点击登录按钮
  3. Xcode 将显示错误(照片 1)

    照片1: http://i.stack.imgur.com/loErxm.jpg

please help me to fix this error please.

请帮我解决这个错误。



but I am not to add the breakpoint to the line number

但我不会在行号中添加断点

http://i.stack.imgur.com/oT8AY.png

http://i.stack.imgur.com/oT8AY.png

回答by EI Captain v2.0

I think thats not an error ... its breakpoint .. just remove it or continue program execution like below

我认为那不是错误......它的断点......只需将其删除或继续执行如下程序

enter image description here

enter image description here

or for remove breakpoints just drag and remove it from show breakpoint navigator

或删除断点只需从显示断点导航器中拖动并删除它

enter image description here

enter image description here

one more thing don't make force unwrap.. use if let to unwrap like

还有一件事不要强制解包..使用 if let 解包就像

if let jsonAbc = jsonResult!["return"] as? String{
       dispatch_async(dispatch_get_main_queue(), {
            self.abc.text = jsonAbc
        })
}  

one more possibility is added in this answerthat "Take a look at the Window in Interface Builder and try to temporary remove all reference to any IBOutlet present in the View Controller"

在此答案中添加了另一种可能性,即“查看界面生成器中的窗口并尝试临时删除对视图控制器中存在的任何 IBOutlet 的所有引用”

回答by jood

You added a breakpoint in xcode, probably without noticing. Go the file, right click on the line number where you breakpoint is, and select "delete breakpoint"

您在 xcode 中添加了一个断点,可能没有注意到。转到文件,右键单击断点所在的行号,然后选择“删除断点”

回答by Devang Tandel

have you deleted button?

你有没有删除按钮?

if yes then you may want to check the outlet of button..

如果是,那么您可能想检查按钮的出口..

just right click on button in story board and find in property inspector if there are two or more action or outlet performed on button.

只需右键单击故事板中的按钮,然后在属性检查器中查找是否在按钮上执行了两个或多个操作或出口。

If there are two action ..one you are currently using and another which was added previously and you have removed from your.swift file you must delete the referring outlet from the button too just keep in mind..

如果有两个操作 .. 一个您当前正在使用,另一个是之前添加的并且您已从您的 .swift 文件中删除,您也必须从按钮中删除引用插座,请记住..