[GH-ISSUE #260] Cannot convert value to expected argument type TokenSuccessHandler #152

Closed
opened 2026-03-03 16:46:10 +03:00 by kerem · 2 comments
Owner

Originally created by @iby on GitHub (Aug 6, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/260

Just updated to 0.6.0 using Carthage and getting an amazing compiler error for OS X.

Error:(60, 22) cannot convert value of type '(OAuthSwiftCredential, NSURLResponse?, [String : String]) -> ()' to expected argument type 'TokenSuccessHandler' (aka '(credential: OAuthSwiftCredential, response: Optional, parameters: Dictionary<String, AnyObject>) -> ()')

oauth.authorizeWithCallbackURL(
    NSURL(string: configuration.callbackUrl)!,
    scope: configuration.scope,
    state: configuration.state,
    params: configuration.parameters,
    success: {
        [weak self] (credential: OAuthSwiftCredential, response: NSURLResponse?, parameters: [String : String]) in
        // …
    },
    failure: {
        [weak self] (error: NSError) in
        // …
    })
Originally created by @iby on GitHub (Aug 6, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/260 Just updated to 0.6.0 using Carthage and getting an amazing compiler error for OS X. > Error:(60, 22) cannot convert value of type '(OAuthSwiftCredential, NSURLResponse?, [String : String]) -> ()' to expected argument type 'TokenSuccessHandler' (aka '(credential: OAuthSwiftCredential, response: Optional<NSURLResponse>, parameters: Dictionary<String, AnyObject>) -> ()') ``` swift oauth.authorizeWithCallbackURL( NSURL(string: configuration.callbackUrl)!, scope: configuration.scope, state: configuration.state, params: configuration.parameters, success: { [weak self] (credential: OAuthSwiftCredential, response: NSURLResponse?, parameters: [String : String]) in // … }, failure: { [weak self] (error: NSError) in // … }) ```
kerem 2026-03-03 16:46:10 +03:00
Author
Owner

@phimage commented on GitHub (Aug 6, 2016):

parameters is no more String:String dictionary but String:AnyObject to accept array and dictionary value

<!-- gh-comment-id:238052844 --> @phimage commented on GitHub (Aug 6, 2016): parameters is no more String:String dictionary but String:AnyObject to accept array and dictionary value
Author
Owner

@iby commented on GitHub (Aug 12, 2016):

Oops, forgot to get back on this. Yes, thank you – String:AnyObject is the answer. Missed the obvious somehow.

<!-- gh-comment-id:239408830 --> @iby commented on GitHub (Aug 12, 2016): Oops, forgot to get back on this. Yes, thank you – `String:AnyObject` is the answer. Missed the obvious somehow.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#152
No description provided.