使用ShareSDK完成Facebook第三方登录和Facebook分享时没办法跳转到Facebook应用
楼主是通过cocoapod接入ShareSDK, 后来发现无论是使用fb分享还是登录, 都是跳出了网页认证(即使我的手机有安装了fb)
后来mob的技术客服小哥告诉我在构造分享参数的时候, 执行参数字典的SSDKEnableUseClientShare方法, 也就是
NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
[shareParams SSDKSetupShareParamsByText:@"Rinpe"
images:nil
url:[NSURL URLWithString:@"http://www.baidu.com"]
title:@"Rinpe"
type:SSDKContentTypeAuto];
[shareParams SSDKEnableUseClientShare];
然后登录呢?由于一开始我在初始化ShareSDK的时候(也就是下面的方法)
+ (void)registerApp:(NSString *)appKey
activePlatforms:(NSArray *)activePlatforms
onImport:(SSDKImportHandler)importHandler
onConfiguration:(SSDKConfigurationHandler)configurationHandler;
在onImport这个block里面需要连接到fb的SDK, 但是我找了半天没找到类似下面这样的方法
[ShareSDKConnector connectFacebook:[xxxx class]];
然后Mob客服的小哥说要用
[ShareSDKConnector connectFacebookMessenger:[FBSDKMessengerSharer class]];
然后我又找了半天没有找到包含FBSDKMessengerSharer这个类的文件, 小哥就说使用pod 'ShareSDK3/ShareSDKPlatforms/FacebookMessengerSDK'
来集成这个SDK, 然而我不知道是我的原因还是他们的原因, pod update老是报错...
迫于无奈, 我自己找到了FBSDKMessengerShareKit, 也就是使用pod 'FBSDKMessengerShareKit'来集成这个SDK...
好吧, 上面的问题解决了..结果一运行...
-canOpenURL: failed for URL: "fbauth2://authorize?client_id=xxxxx 出现了这个错误...
好吧..最后我找到了一个网站...
http://discoverpioneer.com/blog/2015/09/18/updating-facebook-integration-for-ios-9/
按上面的步骤给info.plist添加相应的参数...
问题终于解决了...
原文如下:
Updating Facebook Integration for iOS 9

So with iOS 9 out, there are a few enhancements in security. With that being said, the way your app integrates Facebook may be acting strange, or not working at all.
More than likely this is because you are being affected by App Transport Security. ‘App Transport Security is a feature that improves the security of connections between an app and web services. The feature consists of default connection requirements that conform to best practices for secure connections. Apps can override this default behavior and turn off transport security. ‘ -Apple
With all this being said, this is definitely something that you want to keep inside of your app. But now…. how do you make it work!?!
There are two solutions
1.
First: Whitelist Facebook Servers for Network Requests.
To do this add the following to your info.plist file:<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
Then, Whitelist Facebook Apps by adding this to your info.plist as well:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
There you go, that should do the trick 
2.
If this seems to be too much of a hassle for you, the second option is to turn off App Transport Security. You can do that by adding the following to your info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
使用ShareSDK完成Facebook第三方登录和Facebook分享时没办法跳转到Facebook应用的更多相关文章
- android开发学习——facebook第三方登录,看了你不会后悔
给APP用原生android进行facebook第三方登录. 我们做一件事情,首先得了解其原理,这样才不会迷茫,才知道自己做到什么程度了,心里才会有底. 所以,第一步,了解第三方登录的原理:下面贴一些 ...
- java网站如何集成facebook第三方登录
第一次接触Facebook第三方登录,可能有些地方做的并不全面,只是尝试着做了一个小demo,因为国内接入Facebook的项目并不多,并且多数都是Android或iOS的实现,所以资料也特别少,在此 ...
- 用 Flask 来写个轻博客 (23) — 应用 OAuth 来实现 Facebook 第三方登录
目录 目录 前文列表 扩展阅读 第三方登录流程 OAuth 应用 OAuth 实现 Facebook 第三方登录 实现效果 前文列表 用 Flask 来写个轻博客 (1) - 创建项目 用 Flask ...
- swift-sharesdk集成微信、Facebook第三方登录
好久没有写博客了.最近忙得没有时间更新博客,很忙很忙. 今天就把自己做过的第三方集成和大家分享一下,请大家多多指教. 第一步: 一.获取AppKey(去官方平台注册) 二.下载SDK 三.快速集成 第 ...
- 关于Google+以及Facebook第三方登录实现的一点总结
简述 最近项目中有关于第三方登陆的需求,第三方Facebook以及Google +登录. 正好这几天把这个需求做得差不多了,收个尾,作为一个这方面之前基本从未涉及的小白,总结下开发流程以及过程中遇到的 ...
- facebook第三方登录
一:创建和配置开发者应用 https://developers.facebook.com 登录开发者(可能要手机验证,身份证严重)->创建应用(web )->填写配置,网站网址和应用域名需 ...
- shareSDK实现QQ第三方登录
// QQ登录 case R.id.login_share_qq: Platform qq = ShareSDK.getPlatform(QQ.NAME); qq.SSOSetting(false); ...
- QF——iOS第三方登录和社会化分享
QQ登录的流程: 1.下载SDK,并添加到项目中: 2.添加SDK需要的依赖库,以及配置文件: 3.重写APPDelegate的方法handleOpenURL和openURL: 4.实现Tencent ...
- 分享前端Facebook及Twitter第三方登录
最近公司要求做海外的第三方登录:目前只做了Facebook和Twitter;国内百度到的信息太少VPN FQ百度+Google了很久终于弄好了.但是做第三方登录基本上都有个特点就是引入必须的js,设置 ...
随机推荐
- 使用cglib动态创建java类
转至:http://ckwang17.iteye.com/blog/963881 cglib 是一个开源项目! 是一个强大的,高性能,高质量的Code生成类库,它可以在运行期扩展Java类与实现Jav ...
- 转:PHP - .htaccess设置显示PHP错误
使用.htaccess可以在某种程度上更改PHP的错误显示的设置,实际上,相当于更改PHP.ini的参数,很是方便. 将以下相应代码放到对应目录中的.htaccess文件,即可实现相应功能. 关闭错误 ...
- Node.js 入门(2)
1.http 请求 //调用Node.js自带的http模块 var http = require("http"); //调用http模块提供的函数createServer htt ...
- Milking Grid
poj2185:http://poj.org/problem?id=2185 题意:在一个字符矩阵中,找一个最小的字符子矩阵,使其能够覆盖整个矩阵. 题解:在KMP中i-next[i]是这能够覆盖这个 ...
- COJ 0018 移动盒子
20605移动盒子 难度级别:B: 运行时间限制:1000ms: 运行空间限制:51200KB: 代码长度限制:2000000B 试题描述 你有一行盒子,从左到右依次编号为1,2,3,……,n.可以执 ...
- COJ 3012 LZJ的问题 (有向图判环)
传送门:http://oj.cnuschool.org.cn/oj/home/problem.htm?problemID=1042 试题描述: LZJ有一个问题想问问大家.他在写函数时有时候很头疼,如 ...
- 查找最小的K个元素,使用最大堆。
查找最小的K个元素,使用最大堆,具体代码如下: #define _CRT_SECURE_NO_WARNINGS #include <iostream> using namespace st ...
- Java中join()方法的理解
thread.Join把指定的线程加入到当前线程,可以将两个交替执行的线程合并为顺序执行的线程. 比如在线程B中调用了线程A的Join()方法,直到线程A执行完毕后,才会继续执行线程B. t.join ...
- 基于JAVA的webVNC
jxpiInstall安装程序下载: http://sdlc-esd.sun.com/ESD6/JSCDL/jdk/7u60-b19/jxpiinstall.exe?AuthParam=1402208 ...
- python小技巧
有的时候用一个全新的模块,对其属性和方法,用法并不太了解 这时你可以这样做: 1.dir([name]),如dir(int),会显示int的所有属性和方法