我尝试通过 Twitter Digits 在 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)
}
}
}