Unable to compile AWS CustomIdentityProvider on xcode 8 beta 6

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:

  • Amazon Product Advertising API Signature in iOS
  • if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
  • Using delegates, operations, and queues
  • Send an array as a parameter in a Alamofire POST request
  • In Xcode I see (no paired Apple Watch) even though the watch is paired and the watch's UDID is registered
  • Xcode - Error creating LLDB target
  • 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.

    Solutions Collect From Internet About “Unable to compile AWS CustomIdentityProvider on xcode 8 beta 6”

    Cast to NSDictionary instead of a Swift Dictionary:

    return AWSTask(result: tokens! as NSDictionary)