Search code examples
iosxcodeswift2quickbloxtwitter-digits

Quickblox unrecognized selector sent


I try to register in Quickblox by Twitter Digits but I always get this error

+[QBRequest logInWithTwitterDigitsAuthHeaders:successBlock:errorBlock:]: unrecognized selector sent to class 0x1002c8e70

I tried many different methods but I could to resolve this problem

public static func createUserByPhoneNumber(phoneNumber: String, completion: ((error: NSError?) -> ())?) {
    let configuration = DGTAuthenticationConfiguration(accountFields: .DefaultOptionMask)
    configuration.phoneNumber = phoneNumber
    Digits.sharedInstance().authenticateWithViewController(nil, configuration: configuration) { (session, error) in
        if error == nil {
            let oauthSigning = DGTOAuthSigning(authConfig: Digits.sharedInstance().authConfig, authSession: session)
            createQuickbloxUser(oauthSigning.OAuthEchoHeadersToVerifyCredentials(), completion: { (error) in
                if error == nil {
                    completion?(error: nil)
                } else {
                    completion?(error: error)
                }
            })
        } else {
            print(error.localizedDescription)
            completion?(error: error)
        }
    }
}

private static func createQuickbloxUser(headers: [NSObject : AnyObject], completion: ((error: NSError?) -> ())?) {
    QBRequest.logInWithTwitterDigitsAuthHeaders(headers, successBlock: { (response, user) in
        if response.success {
            print("user is created")
        }
        }) { (errorResponse) in
            if errorResponse.error?.error != nil {
                completion?(error: errorResponse.error?.error)
            }
    }
}

Solution

  • I resolved this problem add of -ObjC in the setting of the project