Error "Thread 1: breakpoint 2.1"

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"]

        }
    }
}

The line I commented prints:

Thread 1: breakpoint 2.1

I need suggestions for fix that error. Any suggestions are very much appreciated


Solution 1:

You may have accidentally set a breakpoint without noticing.

enter image description here

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