SoundCloud API Login



我在使用SoundCloud API的身份验证部分时遇到问题。我正在按照位于此处的教程进行操作: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/部分/重定向URL 的初始化函数按照教程中的说明进行,并且应用程序已注册。

看看NXOAuth2Account.m,其中用户的客户端ID,客户端密钥等用于创建oauthClient。

您还可以在此文件中找到一个名为 description 的方法,该方法应返回重新验证用户所需的所有内容(如果需要):

- (NSString *)description;
{
    return [NSString stringWithFormat:@"<NXOAuth2Account identifier:'%@' accountType:'%@' accessToken:%@ userData:%@>", self.identifier, self.accountType, self.accessToken, self.userData];
}

最新更新