Comments (11)
Maybe im getting redirected to some blank error page
But im not sure if its true cause i cannot print it? Im banging my head into a wall please help
tried to print the error link but im getting app crash on NSLog([url absoluteString]) on the permissions screen and kinda cannot see the next url :(
#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;
}
from livesdk-for-ios.
Hi @ammoqq
Thanks for your interest! Currently we do not support swift/objective c interop . Can you set a break point in that method and check the value of request? I imagine you are getting a blank page without the NSLog because [request URL] is retuning nil so the check for _endUrl is never true. This means it won't every call authDialogCompletedWithResponse on the _delegate object.
from livesdk-for-ios.
so this is my url after i press "YES" on the permissions screen:
2015-07-20 20:57:01.294 Ddukt[363:50716] https://account.live.com/Consent/Update?ru=https://login.live.com/oauth20_authorize.srf ... scope=wl.signin+wl.basic+wl.emails+wl.skydrive+wl.offline_access
2015-07-20 20:57:02.101 Ddukt[363:50716] https://login.live.com/oauth20_authorize.srf?lc=1045&display=ios_phone&response_type=code&redirect_uri= ... &res=success
2015-07-20 20:57:03.286 Ddukt[363:50716] https://login.live.com/oauth20_desktop.srf?code=CODE_HERE&lc=1045
//btw i can only get those values on device, cause on simulator it crashes with NSlog
from livesdk-for-ios.
and the result for the user is simply going from the page that asks for permissions to the blank page and nothing more
I just tested and it actually passes the _endUrl if but the delegate doesnt work somehow ? Cause i just got my print from inside of the if statement
[_delegate authDialogCompletedWithResponse:url];
this seems to not be called even though the if check is true
for example i made the code like that:
-
(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];NSLog(_endUrl);
if ([[url absoluteString] hasPrefix: _endUrl])
{
NSLog(@"hi");
[_delegate authDialogCompletedWithResponse:url];
}
NSString *path = [url absoluteString];
NSLog(path);// 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;
}
and the console says:
2015-07-20 21:12:07.725 Ddukt[371:52576] https://login.live.com/oauth20_desktop.srf
2015-07-20 21:12:07.726 Ddukt[371:52576] hi
2015-07-20 21:12:07.726 Ddukt[371:52576] https://login.live.com/oauth20_desktop.srf?code=CODE_HERE&lc=1045
EDIT: yes im postive! authDialogCompletedWithResponse:url this method never gets called (when i place NSLog inside the LiveAuthRequest.m, inside the authDialogCompletedWithResponse:url method is never called). Any idea why or how to fix that ?
from livesdk-for-ios.
maybe to make delegate work i need to do something like i do for example in google signInGPP?.delegate = self
but how would that look for livesdk LiveAuthDelegate ?
tried THIS:
var live = LiveConnectClient(clientId: ClientID, delegate: self)
live.delegate = self
live.login(self, scopes: Scopes, delegate: self)
but that won't compile
it is strange cause for example when starting to log in the method authCompleted(status: LiveConnectSessionStatus, session: LiveConnectSession!, userState: AnyObject!) {
IS CALLED once!
so i dont know what could be the cause ?
from livesdk-for-ios.
As I mentioned before we do not support swift/object c interop, I can't guarantee that the LiveSDK will work with swift. Can you tell me what the _delegate object looks like at that point? Is it nil?
from livesdk-for-ios.
yes it is null
I would be more than thankful for any clues or ideas how to tackle that, I can try to fix it myself but i have no idea how at the moment
from livesdk-for-ios.
It is possible that the delegate is getting dealloced before the response is sent. The delegate in the LiveAuthDialog is not the same delegate that you pass into LiveConnectClient. It is possible that the LiveConnectClientCore object is getting dealloced before the auth result is finished, this will result in it deallocing the delegate that you are seeing as nil. If you insert a breakpoint or NSLog statement in the dealloc of LiveConnectClientCore you will be able to see if this is actually the case.
from livesdk-for-ios.
well actually dealloc in LiveConnectClientCore is called before i even click yes in the webview!
so it goes like that :
- I press login button
- dealloc in LiveConnectClientCore is called
- i see the webview where i can press yes, but the object is already deallocated
from livesdk-for-ios.
If you want you can add a retain statement to line 96 in LiveConnectClient.m to try and fix the problem
_liveConnectClientCore = [[[LiveConnectClientCore alloc] initWithClientId:clientId
scopes:[LiveAuthHelper normalizeScoers:scopes]
delegate:delegate
userState:userState] retain];
Warning: This may (and probably does) cause a memory leak. As I mentioned we do not support swift /objective c interop and at the time do not have plans to support it in the future.
from livesdk-for-ios.
ok great it indeed fixes the problem (yea i understand it isnt the best way)
Thanks for help!
from livesdk-for-ios.
Related Issues (20)
- logoutWithDelegate does not clear cookie? HOT 2
- Upload fails with timeout after 120 seconds HOT 1
- building from xcode6 crashes the app after authenticated with liveSDK (caused by self.liveClient) HOT 10
- invalid info.plist value. minimumosversion value is 8.0 HOT 1
- LiveSDK Failed to request authorization HOT 1
- 64 bit support "_OBJC_CLASS_$_LiveConnectClient" HOT 1
- Can't use the sdk HOT 2
- LiveSDK.framework not exists? HOT 1
- Crash and memory corruption if "@synthesize varName" and invoking their @selectors like ["varName" function] instead of ["self.varName" function] HOT 1
- Several memory management issues HOT 7
- How to persist the live connect session? HOT 3
- OneDrive for Business (preview)? HOT 7
- New version HOT 2
- iPad authorization as form sheet HOT 1
- Public constants (especially for errors) HOT 1
- Add user_id to LiveConnectSession object HOT 2
- Live Auth Info Stored Unencrypted HOT 1
- Feature request. Add uploading example in PhotoSky project
- Live SDK framework (bin/LiveSDK.framework.zip) missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from livesdk-for-ios.