I am using Amazon Cognito and Facebook login in an ios app. Up until beta 5 this code from this SO thread worked:
class CustomIdentityProvider: NSObject, AWSIdentityProviderManager {
var tokens: [NSString: NSString]?
init(tokens: [NSString: NSString]) {
self.tokens = tokens
}
@objc func logins() -> AWSTask<NSDictionary> {
return AWSTask(result: tokens) // Compile error in beta 6
}
}
In beta 6 I get this compile error:
Cannot convert value of type '[NSString:NSString]?' to expected argument type '_?'
When I change the line to
return AWSTask(result: tokens! as [AnyObject: AnyObject])
I get the error
Type 'AnyObject' does not conform to protocol 'Hashable'
This is swift ver. 3.
强制转换为NSDictionary而不是Swift字典:
return AWSTask(result: tokens! as NSDictionary)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.