web applications - Cordova iOS with Spotify iOS SDK - Trigger Auth -


i'm developing web apps based on cordova, have problem: want include spotify in new app.

spotify has ios sdk (beta) beginner tutorial. worked fine (on app load start auth).

now implement in webapp using cordova.exec(); (not on load - auth on button click (triggered javascript).

i've generated cordova plugin - worked. , can trigger method via cordova.exec();.

this method triggered:

- (bool)startspotifyauth:(cdvinvokedurlcommand*)command {     // create sptauth instance; create login url , open     nsurl *loginurl = [[sptauth defaultinstance] loginurlforclientid:kclientid declaredredirecturl:[nsurl urlwithstring:kcallbackurl] scopes:@[@"login"]];      // opening url in safari close application launch may trigger ios bug, wait bit before doing so.     // [uiapplication performselector:@selector(openurl:) withobject:loginurl afterdelay:0.1];      nslog(@"*** got in debug console ***");      // ask sptauth if url given spotify authentication callback     if ([[sptauth defaultinstance] canhandleurl:loginurl withdeclaredredirecturl:[nsurl urlwithstring:kcallbackurl]]) {          nslog(@"*** got - not - in debug console ***");          // call token swap service logged in session         [[sptauth defaultinstance] handleauthcallbackwithtriggeredauthurl:loginurl tokenswapserviceendpointaturl:[nsurl urlwithstring:ktokenswapurl] callback:^(nserror *error, sptsession *session)         {              if (error != nil) {                  nslog(@"*** auth error: %@", error);                  return;              }               // call -playusingsession: method play track              [self playusingsession:session];         }];         return yes;     }     return no; } 

as can see debug outputs: did not inside if(). don't know why: loginurl looks correct.

you're using wrong url in if statement. @ point, need validate url gets handed application after user has been bounced out safari authentication, not 1 generate using spauth.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -