iOS下 Sharesdk 2.10.4 适配facebook分享
来源:互联网 发布:b2b2c网站源码 编辑:程序博客网 时间:2024/05/17 03:19
还是参考快速集成指南:
http://wiki.sharesdk.cn/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97/
你需要facebook一个app key, 这个对应的app内的bundle必须包含应用的bundle, 否则分享失败
其次, facebook需要分享回调, 我一开始看文档里面的sharesdk接口 看到wx字样就以为只针对微信的, 后来工作人员和我聊说是全部的整体需要的回调接口
初始化:
[ShareSDK registerApp:@"sharesdk id"];[ShareSDK connectFacebookWithAppKey:@"app id" appSecret:@"app secret"];
回调函数, 写死就行了:
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{return [ShareSDK handleOpenURL:url wxDelegate:self];}-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{return [ShareSDK handleOpenURL:url sourceApplication:sourceApplication annotation:annotation wxDelegate:self];}
如果没有这个回调函数, 会在授权后无法发送出去分享, 只会在分享窗口和facebook app之间来回切换而已
通用的发送单一分享方法:
id<ISSContent> shareContent= [ShareSDK content:content defaultContent:@"" image:[ShareSDK jpegImageWithImage:[UIImage imageNamed:SHARE_IMAGE_NAME] quality:0.8]//[ShareSDK imageWithPath:imagePath] title:[ShareSDK getClientNameWithType:shareType] url:nil description:nil mediaType:SSPublishContentMediaTypeText];id<ISSAuthOptions> shareAuthOptions=[ShareSDK authOptionsWithAutoAuth:YES allowCallback:YES authViewStyle:SSAuthViewStyleFullScreenPopupviewDelegate:nil authManagerViewDelegate:AppDelegateHD.agviewDelegate];[ShareSDK showShareViewWithType:shareType container:[ShareSDK container]content:shareContentstatusBarTips:YES authOptions:shareAuthOptions shareOptions:[ShareSDK defaultShareOptionsWithTitle:[ShareSDK getClientNameWithType:shareType] oneKeyShareList:nil//[NSArray defaultOneKeyShareList] qqButtonHidden:YES wxSessionButtonHidden:YESwxTimelineButtonHidden:YES showKeyboardOnAppear:NO shareViewDelegate:AppDelegateHD.agviewDelegatefriendsViewDelegate:AppDelegateHD.agviewDelegate picViewerViewDelegate:nil] result:^(ShareType type, SSResponseState state, id<ISSPlatformShareInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) { if (state == SSResponseStateSuccess) { NSLog(@"发表成功"); } else if (state == SSPublishContentStateFail) { NSLog(@"发布失败!error code == %d, error code == %@", [error errorCode], [error errorDescription]); } }];
最后需要编辑URL Scheme, 将facebook id加上"fb"前缀就ok, 在info面板最下面的URL Type中设置
0 0
- iOS下 Sharesdk 2.10.4 适配facebook分享
- iOS shareSDK进行分享
- iOS ShareSDK分享注意事项
- iOS 分享 sharesdk集成
- iOS ShareSDK 分享
- IOS shareSDK分享异常
- facebook android sharesdk 分享清除授权代码
- 关于ios分享(ShareSDK)
- iOS:shareSDK 登录,分享,关注
- iOS分享(一) shareSDK
- IOS集成ShareSDK社会化分享
- ios sharesdk分享 本地视频
- IOS,Android-Facebook分享
- iOS社会化分享-iOS系统分享,shareSDK分享,Umeng分享
- facebook iOS Tutorial (分享到facebook)
- IOS 植入Facebook SDK --- 分享
- iOS中用ShareSDK一键分享方法
- iOS ShareSDK 分享到新浪微博
- JAVA的网络编程【转】
- 寻根1:unix/linux下的父子进程交互
- PHP-表单的读写,File文件的操作等---ShinePans
- C++异常机制的实现方式和开销分析
- 库的 link 和 runtime-link,搭配shared 和 static
- iOS下 Sharesdk 2.10.4 适配facebook分享
- magento登陆问题
- 自定义InputFormat
- c#多线程之QueueUserWorkItem
- >>和>>>运算符
- 最近一些感想
- POJ1322----Chocolate
- 面试笔试重点总结:操作系统、计算机网络、设计模式
- 最近压力好大