我将一半开始的项目转换为Swift,让我了解基础知识和怪癖。我发现了一个问题,如果没有我使用的库(AFOAuth2Client)的更新/分支,我不确定是否可以解决。
我试图调用AFOAuth2Client的authenticateUsingOAuthWithPath: scope: success: failure:
方法。但是,它还包含以authenticateUsingOAuthWithPath:
开头的其他4种方法。
即使我的参数不同,快速编译器(Xcode Beta 2)也在抱怨我说
"模糊地使用' authenticateUsingOAuthWithPath'"。
对于那些需要了解我正在尝试做什么的人....
client.authenticateUsingOAuthWithPath(path: "string here", scope: "string here", success: { (cred: AFOAuthCredential!) -> Void in
// Success
}, failure: { (error: NSError!) -> Void in
// Failure
})
AFOauth2Client的标题定义了以下问题原因......
- (void)authenticateUsingOAuthWithPath:(NSString *)path
scope:(NSString *)scope
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
- (void)authenticateUsingOAuthWithPath:(NSString *)path
refreshToken:(NSString *)refreshToken
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
- (void)authenticateUsingOAuthWithPath:(NSString *)path
code:(NSString *)code
redirectURI:(NSString *)uri
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
- (void)authenticateUsingOAuthWithPath:(NSString *)path
parameters:(NSDictionary *)parameters
success:(void (^)(AFOAuthCredential *credential))success
failure:(void (^)(NSError *error))failure;
任何人都可以提出一个建议,指出swift到特定的方法或确认我需要fork / alter?
答案 0 :(得分:1)
使用
client.authenticateUsingOAuthWithPath("string here"
而不是
client.authenticateUsingOAuthWithPath(path: "string here"