簡體   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