Error quot;Thread 1: breakpoint 2.1quot;(错误“线程 1:断点 2.1;)
本文介绍了错误“线程 1:断点 2.1";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个 REST API 管理器.它给出了一个错误,我无法修复它.我得到的错误如下突出显示.
I am working on a REST API Manager. It is giving an error and I am not able to fix it. The error I got is given below as highlighted.
import Foundation
import Alamofire
import SwiftyJSON
class RestApiManager {
var resources: JSON = [
"resources": [
"resourceA": []
]
]
let apiUrl: String
let apiUsername: String
let apiPassword: String
init(apiUrl: String, apiUsername: String, apiPassword: String) {
self.apiUrl = apiUrl
self.apiUsername = apiUsername
self.apiPassword = apiPassword
getApiResourceA() { responseObject, error in
let resourceA = JSON(responseObject!)
self.resources["resources"]["resourceA"] = resourceA
}
}
func collectDataFromApi(completionHandler: (responseObject: NSDictionary?, error: NSError?) -> ()) {
prepareHttpRequest(completionHandler)
}
func prepareHttpRequest(completionHandler: (responseObject: NSDictionary?, error: NSError?) -> ()) {
let alamofireRequest = Alamofire.request(.GET, "(self.apiUrl)")
alamofireRequest.authenticate(user: self.apiUsername, password: self.apiPassword)
alamofireRequest.responseJSON { request, response, responseObject, error in
completionHandler(responseObject: responseObject as? NSDictionary, error: error)
}
}
func getAllResources() -> JSON {
return self.resources
}
func getApiResourceA(completion: (responseObject: NSDictionary?, error: NSError?) -> ()) {
collectDataFromApi() { responseObject, error in
completion(responseObject: responseObject, error: error)
}
}
}
当我调用这个类来获取资源时:
And when I call this class to get the resources:
override func viewDidLoad() {
super.viewDidLoad()
if record != nil {
let url = record?.url
let username = record?.username
let password = record?.password
let restApiManager = RestApiManager(apiUrl: url!, apiUsername: username!, apiPassword: password!) // This line seems buggy
let delay = 10.0 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(time, dispatch_get_main_queue()) {
let Resources = restApiManager.getAllResources()
let ResourceA = Resources["resources"]["resourceA"]
}
}
}
我注释的行打印:
线程 1:断点 2.1
Thread 1: breakpoint 2.1
我需要修复该错误的建议.任何建议都非常感谢
I need suggestions for fix that error. Any suggestions are very much appreciated
推荐答案
你可能不小心设置了断点.
You may have accidentally set a breakpoint without noticing.
单击并拖动代表断点的蓝色刻度线将其擦除.
Click and drag the blue tick representing the breakpoint outside of the gutter to erase it.
这篇关于错误“线程 1:断点 2.1";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:错误“线程 1:断点 2.1";
猜你喜欢
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01