Bruno Morgado
Bruno Morgado

Reputation: 507

facebook iOS SDK authorization without redirect to safari

I need to authorize the access to facebook within the app, because I need to store the cookies where they can be used by the app later. So I want that the autorization takes place in a webview without the need for redirecting to safari. After some research I saw some answers for this problem, which consist of changing the following line:

[self authorizeWithFBAppAuth:YES safariAuth:YES];

to

[self authorizeWithFBAppAuth:NO safariAuth:NO];

However, this is not working for me. It does not redirect to safari anymore, but does not open the webview either. Am I missing something? The connection with facebook works fine when redirecting to safari, so the SDK should be well installed.

Thanks in advance!

EDIT

With the help of breakpoints in the FBDialog.m code, I can see that the method webViewDidFinishLoad:is being called, so I assume it is working as expected. However, I also add the line NSLog(@"view %@",self); to the end of the init method in the FBDialog.m, which produces the text in the console:

view <FBLoginDialog: 0x4e316f0; frame = (0 0; 0 0); autoresize = W+H; layer = <CALayer: 0x4e321c0>>

As you can see the width and height of the frame is 0, 0. Could this be the reason for the UIWebView never show up? A little help would be greatly appreciated.

Upvotes: 3

Views: 1983

Answers (1)

Bruno Morgado
Bruno Morgado

Reputation: 507

I found the problem. I was calling the authorize method of the facebook object before the makeKeyAndVisiblemethod of the window.

Upvotes: 2

Related Questions