1. 下载友盟最新风向SDK。
2. 集成SDK到工程,可以仿照友盟官方说明进行配置,如果是xcode7 以上的版本配置的时候要格外注意。
2.1 配置白名单,在info.plist
LSApplicationQueriesSchemes
weixin
sinaweibohd
sinaweibo
sinaweibosso
weibosdk
weibosdk2.5
mqqapi
mqq
mqqOpensdkSSoLogin
mqqconnect
mqqopensdkdataline
mqqopensdkgrouptribeshare
mqqopensdkfriend
mqqopensdkapi
mqqopensdkapiV2
mqqopensdkapiV3
mqzoneopensdk
wtloginmqq
wtloginmqq2
mqqwpa
mqzone
mqzonev2
mqzoneshare
wtloginqzone
mqzonewx
mqzoneopensdkapiV2
mqzoneopensdkapi19
mqzoneopensdkapi
mqqbrowser
mttbrowser
alipay
alipayshare
renrenios
renrenapi
renren
renreniphone
laiwangsso
yixin
yixinopenapi
line
fbapi
fb-messenger-api
fbauth2
fbshareextension
2.2 在info.plist配置允许http请求
NSAppTransportSecurity
NSAllowsArbitraryLoads
2.3 配置 URL Types
3.集成frameworks
4 代码集成
4.1 AppDelegate.m中注册
//设置友盟Appkey
[UMSocialDatasetAppKey:@""];
//三个参数均为在微信开放者平台申请获得
[UMSocialWechatHandlersetWXAppId:@""appSecret:@""url:@""];
//开启qq分享功能
[UMSocialQQHandlersetQQWithAppId:@""appKey:@""url:@""];
//设置Xcode的url scheme格式为“QQ”+腾讯QQ互联应用appId转换成十六进制(不足8位前面补0)
//开启sina分享功能
[UMSocialSinaSSOHandleropenNewSinaSSOWithAppKey:@""secret:@""RedirectURL:@""];
//[UMSocialSinaSSOHandler openNewSinaSSOWithAppKey:@""
//secret:@""
//RedirectURL:@""];
//统一设置某控件的显示效果
[[UINavigationBarappearance]setBarStyle:UIBarStyleBlack];
//[[UILabelappearance] setText:@"soo56.com"];
4.2 监听并调用
[UMSocialDatadefaultData].extConfig.wechatTimelineData.url=@"http://www.soo56.com/";
[UMSocialDatadefaultData].extConfig.wechatSessionData.url=@"http://www.soo56.com/";
//标题
[UMSocialDatadefaultData].extConfig.wechatFavoriteData.title=self.title;
//图文、纯图片、纯文字、应用三种类型
// [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeImage;
//更改qq分享链接
[UMSocialDatadefaultData].extConfig.qqData.url=@"http://www.soo56.com/";
// Qzone分享文字与图片缺一不可,否则会出现错误码10001
[UMSocialDatadefaultData].extConfig.qzoneData.title=@"soo56.com";
[UMSocialDatadefaultData].extConfig.qzoneData.url=@"http://www.soo56.com/";
[[UMSocialDatadefaultData].urlResourcesetResourceType:UMSocialUrlResourceTypeImageurl:@"http://www.soo56.com/2014index/images/logo.jpg"];
[UMSocialDataopenLog:YES];
5.iOS友盟分享,新浪微博风向成功,返回崩溃错误解决:
在Appdelegate.m 中添加一个方法
//该方法设计社会化分享,解决分享SDK与SDK的冲突
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation{
BOOLresult = [UMSocialSnsServicehandleOpenURL:url];
if(result ==FALSE) {
//调用其他SDK,例如支付宝SDK等
}
return result;
}
网友评论