Macos SoundCloud OSX Oauth进程不';除非取消,否则不要创建帐户
我一直在尝试使用CocoaSoundCloudAPI为Cocoa中的OSX创建一个基本的桌面应用程序 我正在努力进行身份验证。单击登录按钮将打开一个外部浏览器窗口,尝试对我的应用进行身份验证。如果我点击“连接”,连接按钮会显示一个可爱的动画。。。永远,并且Macos SoundCloud OSX Oauth进程不';除非取消,否则不要创建帐户,macos,cocoa,authentication,oauth-2.0,soundcloud,Macos,Cocoa,Authentication,Oauth 2.0,Soundcloud,我一直在尝试使用CocoaSoundCloudAPI为Cocoa中的OSX创建一个基本的桌面应用程序 我正在努力进行身份验证。单击登录按钮将打开一个外部浏览器窗口,尝试对我的应用进行身份验证。如果我点击“连接”,连接按钮会显示一个可爱的动画。。。永远,并且[SCSoundCloud帐户]为空 但是,如果在此过程中单击外部浏览器窗口中的“取消”,我会看到SCAccount变为!无 有人能解释一下吗 这是我的密码: #import "SCMAppDelegate.h" @implementatio
[SCSoundCloud帐户]
为空
但是,如果在此过程中单击外部浏览器窗口中的“取消”,我会看到SCAccount变为!无
有人能解释一下吗
这是我的密码:
#import "SCMAppDelegate.h"
@implementation SCMAppDelegate
+ (void)initialize
{
[SCSoundCloud setClientID:@"MYID"
secret:@"MYSECRET"
redirectURL:[NSURL URLWithString:@"sampleproject1://oauth"]];
}
- (IBAction)login:(id)sender
{
[SCSoundCloud requestAccessWithPreparedAuthorizationURLHandler:^(NSURL *preparedURL){
// Load the URL in a web view or open it in an external browser
[[NSWorkspace sharedWorkspace] openURL:preparedURL];
}];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
{
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
andSelector:@selector(handleURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
}
- (void)handleURLEvent:(NSAppleEventDescriptor*)event
withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
{
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
BOOL handled = [SCSoundCloud handleRedirectURL:[NSURL URLWithString:url]];
if (!handled) {
NSLog(@"The URL (%@) could not be handled by the SoundCloud API. Maybe you want to do something with it.", url);
}
NSLog(@"This is the account: %@", [SCSoundCloud account]);
}
@end
我一直在用它作为向导,发现大多数东西都有用。有人能把我推到正确的方向吗?我做了一些NSLogging,发现事实上,我正在接收一个有效的SoundCloud帐户对象,只是需要更多的时间来接收该对象 然而,令我惊讶的是,我的外部浏览器窗口从未收到指示连接已完成的通知-这是代表我的错误还是外部oauth2请求时经常发生的错误
看起来,即使我在我的应用程序中使用Facebook授权,我也从未在浏览器页面上收到认证已完成的通知。有人知道我怎样才能做到这一点吗?我很确定我的回调url是正确的,但我会继续尝试