繁体   English   中英

SoundCloud API登录

[英]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 / section / redirectURL的初始化函数按照教程中的指示进行,并且该应用程序已注册。

查看NXOAuth2Account.m,其中使用用户的客户端ID,客户端密码等来创建oauthClient。

您还可以在此文件中找到一种称为description的方法,该方法应返回您需要重新认证用户的所有内容:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM