ios8 - Unsupported URL error using Swift and opening custom URL scheme -
i'm working spotify ios sdk, , trying relaunch app after authenticating user. using custom url
scheme, i'm able have app relaunched, i'm getting error in callback function i'm not receiving session data user. error is:
error domain=nsurlerror
here's i'm capturing error , printing console:
func application(application: uiapplication, openurl url: nsurl, sourceapplication: string?, annotation: anyobject?) -> bool { var authcallback: sptauthcallback = { (error: nserror!, session: sptsession!) in if (error != nil) { println("there's error \(error)") return } }
here's full text of error message:
error domain=nsurlerrordomain code=-1002 "unsupported url" userinfo=0x7f97931069a0 {nslocalizeddescription=unsupported url, nsunderlyingerror=0x7f979140a610 "unsupported url"}
fwiw, same method seems work fine in objective-c demo apps spotify provides, i'm assuming i'm missing in swift translation.
edit: here's how in obj-c. there's no error populated here.
- (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { sptauthcallback authcallback = ^(nserror *error, sptsession *session) { // callback that'll triggered when auth completed (or fails). if (error != nil) { nslog(@"*** auth error: %@", error); return; }
Comments
Post a Comment