我在SoundCloud应用程序接口的身份验证部分遇到了问题。我正在遵循位于此处的教程:http://developer.soundcloud.com/docs/api/ios-quickstart#authentication
我遵循他们编写的代码,它运行/编译,但不进行身份验证。从以下代码请求登录时:
(IBAction) login:(id) sender
{
SCLoginViewControllerCompletionHandler handler = ^(NSError *error) {
if (SC_CANCELED(error)) {
NSLog(@"Canceled!");
} else if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Done!");
}
};
[SCSoundCloud requestAccessWithPreparedAuthorizationURLHandler:^(NSURL *preparedURL) {
SCLoginViewController *loginViewController;
loginViewController = [SCLoginViewController
loginViewControllerWithPreparedURL:preparedURL
completionHandler:handler];
[self presentModalViewController:loginViewController animated:YES];
}];它返回控制台错误:
2013-12-26 16:11:23.902 SampleProject[14748:4717] -[NXOAuth2PostBodyStream open]
Stream has been reopened after close
2013-12-26 16:11:24.198 SampleProject[14748:70b] Done!然后随后对SCSoundCloud帐户的调用返回nil。
在使用应用程序的过程中,登录视图出现,我似乎已成功登录,但似乎没有帐户已保存/注册。有什么建议吗?
此外,我使用clientID / section / redirectURL的初始化函数是按照教程中的指示执行的,并且应用程序已注册。
发布于 2014-03-19 22:55:48
看一下NXOAuth2Account.m,其中使用了用户的客户端ID、客户端密钥等来创建oauthClient。
您还可以在此文件中找到一个名为description的方法,该方法应返回重新验证用户所需的所有内容:
- (NSString *)description;
{
return [NSString stringWithFormat:@"<NXOAuth2Account identifier:'%@' accountType:'%@' accessToken:%@ userData:%@>", self.identifier, self.accountType, self.accessToken, self.userData];
}https://stackoverflow.com/questions/20791436
复制相似问题