Reputation: 363
Have migrated code from swift 2 to swift 3. Getting error Value of type 'Any?' has no member 'value'. can anybody help me out AFNetworking
with Swift3
, totally stuck.
let manager = AFHTTPSessionManager()
manager.get(
ADS_URL,
parameters: [],
success: { (operation,responseObject) in
self.loggedIn = responseObject.value(forKey: "success") as! Bool // Error Value of type 'Any?' has no member 'value'
},
failure: { (operation,error) in
sender!.setCMSError(error)
}
)
Upvotes: 0
Views: 856
Reputation: 89
Swift 3 is very strict on types. You should downcast explicitly responseObject from the default Any? to an NSDictionary in order to apply directly to the value under the key ["success"].
Upvotes: 1