xCode:如何修复线程5:EXC_BREAKPOINT(代码= 1,子代码= 0x10025c76c) [英] xCode: how to fix Thread 5: EXC_BREAKPOINT (code=1, subcode=0x10025c76c)

查看:2114
本文介绍了xCode:如何修复线程5:EXC_BREAKPOINT(代码= 1,子代码= 0x10025c76c)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



这是我的代码

  @IBOutlet weak var abc:UILabel! 

...

@IBAction func btnLogin(发件人: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(错误! = nil){
print(error)
}

do {
jsonResult =尝试NSJSONSerialization.JSONObjectWithData(data!,options:.AllowFragments)as! NSDictionary
让jsonAbc:String!= jsonResult![return] as!String

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

}




  1. 在iPhone上运行应用程序(9.2版本)

  2. 点击登录按钮

  3. xCode将显示错误(照片1)



    照片1:



    或删除断点只需将其拖放到show breakpoint navigator





    还有一件事情不要强行打开包装..如果让我们解开,请使用

     如果让jsonAbc = jsonResult![return]为?字符串{
    dispatch_async(dispatch_get_main_queue(),{
    self.abc.text = jsonAbc
    })
    }

    在此回答查看Interface Builder中的窗口并尝试临时删除对View Controller中存在的任何IBOutlet的所有引用


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

    Thread 5: EXC_BREAKPOINT (code=1, subcode=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/loErx.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

    解决方案

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

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

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

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

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

    这篇关于xCode:如何修复线程5:EXC_BREAKPOINT(代码= 1,子代码= 0x10025c76c)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆