Error "Thread 1: Breakpoint 2.1"

I am working on a REST API Manager. This gives an error, and I cannot fix it. The resulting error is shown 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 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"] } } } 

In a line, I commented on the fingerprints:

Topic 1: breakpoint 2.1

I need suggestions to fix this error. Any suggestions are much appreciated

+6
source share
1 answer

You may have accidentally set a breakpoint without noticing.

enter image description here

Click and drag the blue shortcut representing the breakpoint outside the gutter to erase it.

+9
source

All Articles