------------恢复内容开始------------
分享的功能,基本每个APP都会有,一般就是之前用shareSDK,后来就是友盟,还有苹果原生的,
友盟用的会多一点,也很方便,不过官方的文档有时候会看的云里雾里的,现总结一下:
1、注册应用
具体话去友盟平台上看下就行,这里不再阐述
2、集成
使用cocopods集成,具体的使用官网上都很明确了,下面只贴出代码:
target ‘项目名称‘ do # U-Share SDK UI模块(分享面板,建议添加) pod ‘UMengUShare/UI’ # 集成微信(精简版0.2M) pod ‘UMengUShare/Social/ReducedWeChat‘ # 集成微信(完整版14.4M) pod ‘UMengUShare/Social/WeChat‘ # 集成QQ/QZone/TIM(精简版0.5M) pod ‘UMengUShare/Social/ReducedQQ‘ # 集成QQ/QZone/TIM(完整版7.6M) pod ‘UMengUShare/Social/QQ‘ # 集成新浪微博(精简版1M) pod ‘UMengUShare/Social/ReducedSina‘ # 集成新浪微博(完整版25.3M) pod ‘UMengUShare/Social/Sina‘ # 集成Facebook/Messenger pod ‘UMengUShare/Social/Facebook‘ # 集成Twitter pod ‘UMengUShare/Social/Twitter‘ # 集成支付宝 pod ‘UMengUShare/Social/AlipayShare‘ # 集成钉钉 pod ‘UMengUShare/Social/DingDing‘ # 集成豆瓣 pod ‘UMengUShare/Social/Douban‘ # 集成人人 pod ‘UMengUShare/Social/Renren‘ # 集成腾讯微博 pod ‘UMengUShare/Social/TencentWeibo‘ # 集成来往(点点虫) pod ‘UMengUShare/Social/LaiWang‘ # 集成易信 pod ‘UMengUShare/Social/YiXin‘ # 集成领英 pod ‘UMengUShare/Social/Linkedin‘ # 集成Flickr pod ‘UMengUShare/Social/Flickr‘ # 集成Kakao pod ‘UMengUShare/Social/Kakao‘ # 集成Tumblr pod ‘UMengUShare/Social/Tumblr‘ # 集成Pinterest pod ‘UMengUShare/Social/Pinterest‘ # 集成Instagram pod ‘UMengUShare/Social/Instagram‘ # 集成Line pod ‘UMengUShare/Social/Line‘ # 集成WhatsApp pod ‘UMengUShare/Social/WhatsApp‘ # 集成有道云笔记 pod ‘UMengUShare/Social/YouDao‘ # 集成印象笔记 pod ‘UMengUShare/Social/EverNote‘ # 集成Google+ pod ‘UMengUShare/Social/GooglePlus‘ # 集成Pocket pod ‘UMengUShare/Social/Pocket‘ # 集成DropBox pod ‘UMengUShare/Social/DropBox‘ # 集成VKontakte pod ‘UMengUShare/Social/VKontakte‘ # 集成邮件 pod ‘UMengUShare/Social/Email‘ # 集成短信 pod ‘UMengUShare/Social/SMS‘ # 加入IDFA获取 pod ‘UMengUShare/Plugin/IDFA‘ end
然后执行pod install命令即可。
3、第三方平台配置
ios9以上需要增加一个可跳转APP的白名单,LSApplicationQueriesSchemes,具体内容如下:
<key>LSApplicationQueriesSchemes</key> <array> <!-- 微信 URL Scheme 白名单--> <string>wechat</string> <string>weixin</string> <!-- 新浪微博 URL Scheme 白名单--> <string>sinaweibohd</string> <string>sinaweibo</string> <string>sinaweibosso</string> <string>weibosdk</string> <string>weibosdk2.5</string> <!-- QQ、Qzone、TIM URL Scheme 白名单--> <string>mqqapi</string> <string>mqq</string> <string>mqqOpensdkSSoLogin</string> <string>mqqconnect</string> <string>mqqopensdkdataline</string> <string>mqqopensdkgrouptribeshare</string> <string>mqqopensdkfriend</string> <string>mqqopensdkapi</string> <string>mqqopensdkapiV2</string> <string>mqqopensdkapiV3</string> <string>mqqopensdkapiV4</string> <string>mqzoneopensdk</string> <string>wtloginmqq</string> <string>wtloginmqq2</string> <string>mqqwpa</string> <string>mqzone</string> <string>mqzonev2</string> <string>mqzoneshare</string> <string>wtloginqzone</string> <string>mqzonewx</string> <string>mqzoneopensdkapiV2</string> <string>mqzoneopensdkapi19</string> <string>mqzoneopensdkapi</string> <string>mqqbrowser</string> <string>mttbrowser</string> <string>tim</string> <string>timapi</string> <string>timopensdkfriend</string> <string>timwpa</string> <string>timgamebindinggroup</string> <string>timapiwallet</string> <string>timOpensdkSSoLogin</string> <string>wtlogintim</string> <string>timopensdkgrouptribeshare</string> <string>timopensdkapiV4</string> <string>timgamebindinggroup</string> <string>timopensdkdataline</string> <string>wtlogintimV1</string> <string>timapiV1</string> <!-- 支付宝 URL Scheme 白名单--> <string>alipay</string> <string>alipayshare</string> <!-- 钉钉 URL Scheme 白名单--> <string>dingtalk</string> <string>dingtalk-open</string> <!--Linkedin URL Scheme 白名单--> <string>linkedin</string> <string>linkedin-sdk2</string> <string>linkedin-sdk</string> <!-- 点点虫 URL Scheme 白名单--> <string>laiwangsso</string> <!-- 易信 URL Scheme 白名单--> <string>yixin</string> <string>yixinopenapi</string> <!-- instagram URL Scheme 白名单--> <string>instagram</string> <!-- whatsapp URL Scheme 白名单--> <string>whatsapp</string> <!-- line URL Scheme 白名单--> <string>line</string> <!-- Facebook URL Scheme 白名单--> <string>fbapi</string> <string>fb-messenger-api</string> <string>fbauth2</string> <string>fbshareextension</string> <!-- Twitter URL Scheme 白名单--> <string>twitter</string> <string>twitterauth</string> <!-- Kakao URL Scheme 白名单--> <!-- 注:以下第一个参数需替换为自己的kakao appkey--> <!-- 格式为 kakao + "kakao appkey"--> <string>kakaofa63a0b2356e923f3edd6512d531f546</string> <string>kakaokompassauth</string> <string>storykompassauth</string> <string>kakaolink</string> <string>kakaotalk-4.5.0</string> <string>kakaostory-2.9.0</string> <!-- pinterest URL Scheme 白名单--> <string>pinterestsdk.v1</string> <!-- Tumblr URL Scheme 白名单--> <string>tumblr</string> <!-- 印象笔记 --> <string>evernote</string> <string>en</string> <string>enx</string> <string>evernotecid</string> <string>evernotemsg</string> <!-- 有道云笔记--> <string>youdaonote</string> <string>ynotedictfav</string> <string>com.youdao.note.todayViewNote</string> <string>ynotesharesdk</string> <!-- Google+--> <string>gplus</string> <!-- Pocket--> <string>pocket</string> <string>readitlater</string> <string>pocket-oauth-v1</string> <string>fb131450656879143</string> <string>en-readitlater-5776</string> <string>com.ideashower.ReadItLaterPro3</string> <string>com.ideashower.ReadItLaterPro</string> <string>com.ideashower.ReadItLaterProAlpha</string> <string>com.ideashower.ReadItLaterProEnterprise</string> <!-- VKontakte--> <string>vk</string> <string>vk-share</string> <string>vkauthorize</string> </array>
4、设置URL Scheme
配置第三方平台URL Scheme未列出则不需设置
平台 | 格式 | 举例 | 备注 |
微信 | 微信appKey | wxdc1e388c3822c80b | |
QQ/Qzone | 需要添加两项URL Scheme: 1、"tencent"+腾讯QQ互联应用appID 2、“QQ”+腾讯QQ互联应用appID转换成十六进制(不足8位前面补0) |
如appID:100424468 1、tencent100424468 2、QQ05fc5b14 |
QQ05fc5b14为100424468转十六进制而来,因不足8位向前补0,然后加"QQ"前缀 |
新浪微博 | “wb”+新浪appKey | wb3921700954 | |
支付宝 | “ap”+appID | ap2015111700822536 | URL Type中的identifier填"alipayShare" |
钉钉 | 钉钉appkey | dingoalmlnohc0wggfedpk | identifier的参数都使用dingtalk |
易信 | 易信appkey | yx35664bdff4db42c2b7be1e29390c1a06 | |
点点虫 | 点点虫appID | 8112117817424282305 | URL Type中的identifier填"Laiwang" |
领英 | “li”+appID | li4768945 | |
“fb”+FacebookID | fb506027402887373 | ||
“twitterkit-”+TwitterAppkey | twitterkit-fB5tvRpna1CKK97xZUslbxiet | ||
VKontakte | “vk”+ VKontakteID | vk5786123 |
原文地址:https://www.cnblogs.com/hero11223/p/12294933.html
时间: 2024-10-11 03:22:37