facebook iOS SDK授权,无需重定向到safari [英] facebook iOS SDK authorization without redirect to safari

查看:114
本文介绍了facebook iOS SDK授权,无需重定向到safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要授权在应用程序中访问Facebook,因为我需要将cookies存储在应用程序的后面。所以我希望自动更新发生在网络视图中,而不需要重定向到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];

[self authorizeWithFBAppAuth:NO safariAuth:NO];

但是,这对我来说不起作用。它不再重定向到safari了,但也不打开webview。我错过了什么吗?当重定向到Safari后,与Facebook的连接工作正常,所以SDK应该安装得很好。

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.

提前感谢!

编辑

借助FBDialog.m代码中的断点,我可以看到方法 webViewDidFinishLoad:正在被调用,所以我认为它按预期工作。但是,我还将 NSLog(@view%@,self); 添加到 init的末尾方法在FBDialog.m中,它在控制台中产生文本:

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);自动调整= W + H; layer =< CALayer:0x4e321c0>>

正如你可以看到框架的宽度和高度为0,是UIWebView从不出现的原因?
一点帮助将不胜感激。

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.

推荐答案

我发现问题。在窗口的 makeKeyAndVisible 方法之前,我正在调用facebook对象的授权方法。

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

这篇关于facebook iOS SDK授权,无需重定向到safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆