ios - Spotify login error -canOpenURL -


i'm trying understand spotify's login/authorization process. following tutorial , ended code. when try login error: -canopenurl: failed url: "spotify-action://" - error: "(null)"

i checked repo , saw needed add spotify-action , spotify info.plist under lsapplicationqueriesschemes. after doing still getting above error.

class spotifyloginviewcontroller: uiviewcontroller, sptauthviewdelegate{ let kclientid = " client id" let kcallbackurl = "my callback"  @ibaction func loginspotify(sender: anyobject){     sptauth.defaultinstance().clientid = kclientid     sptauth.defaultinstance().redirecturl = nsurl(string: kcallbackurl)     sptauth.defaultinstance().requestedscopes = [sptauthstreamingscope]     sptauth.defaultinstance().sessionuserdefaultskey = "spotifysession"     //sptauth.defaultinstance().tokenswapurl = nsurl(string: ktokenswapurl) //you not need initially, unless want refresh tokens    // sptauth.defaultinstance().tokenrefreshurl = nsurl(string: ktokenrefreshserviceurl)//you not need unless want refresh tokens      let spotifyauthviewcontroller = sptauthviewcontroller.authenticationviewcontroller()     spotifyauthviewcontroller.delegate = self     spotifyauthviewcontroller.modalpresentationstyle = uimodalpresentationstyle.overcurrentcontext     spotifyauthviewcontroller.definespresentationcontext = true     presentviewcontroller(spotifyauthviewcontroller, animated: false, completion: nil)  }   func authenticationviewcontroller(authenticationviewcontroller: sptauthviewcontroller!, didloginwithsession session: sptsession!) {     print("logged in") }  func authenticationviewcontroller(authenticationviewcontroller: sptauthviewcontroller!, didfailtologin error: nserror!) {     print("failed log in")     print(error)     authenticationviewcontroller.clearcookies(nil) }  func authenticationviewcontrollerdidcancellogin(authenticationviewcontroller: sptauthviewcontroller!) {     print("user canceled log in")     authenticationviewcontroller.clearcookies(nil) } } 

if spotify app isn't installed on device action open spotify fail , console print error: -canopenurl: failed url: "spotify-action://" - error: "(null)". happens app isn't installed on device , attempt launch non-existing app occurs.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -