Search code examples
ioslive-sdk

LiveSDK + iOS login: not redirecting back to the app after allowing permissions


I have imported liveSDK with pods, my app is set.

This is how I login in swift (I've implemented LiveAuthDelegate too):

var live = LiveConnectClient(clientId: ClientID, delegate: self)
live.login(self, scopes: Scopes, delegate: self)
  1. I get the login and password screen, I sign in with my credentials.
  2. I get the permissions view where I can say yes or no to the asked permissions
  3. I click yes
  4. I get blank page... instead of being redirected back to my app

Any ideas ? please help

EDIT: i think i am redirected to some page like https://login.live.com/oauth20_desktop.srf?error=server_error&lc=1033 this site and its blank? what could be the reason ? I tried logging the url in the LiveSDK, but its crashing the app on NSLog

#pragma mark UIWebViewDelegate methods

(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:    (NSURLRequest *)request 
navigationType:(UIWebViewNavigationType)navigationType 
{
NSURL *url = [request URL];

NSLog([url absoluteString]);

if ([[url absoluteString] hasPrefix: _endUrl]) 
{
[_delegate authDialogCompletedWithResponse:url];
}

// Always return YES to work around an issue on iOS 6 that returning NO may cause
// next Login request on UIWebView to hang.
return YES;
}

Solution

  • In the end i happened to add a retaint:

    _liveConnectClientCore = [[[LiveConnectClientCore alloc] initWithClientId:clientId
                                                                   scopes:[LiveAuthHelper normalizeScoers:scopes]
                                                                delegate:delegate
                                                               userState:userState] retain];