0
我嘗試通過Twitter的位數Quickblox註冊,但我總是得到這個錯誤Quickblox無法識別的選擇發送
+[QBRequest logInWithTwitterDigitsAuthHeaders:successBlock:errorBlock:]: unrecognized selector sent to class 0x1002c8e70
我嘗試了許多不同的方法,但我能解決這個問題
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)
}
}
}