设为首页 加入收藏

TOP

React Native 轻松集成分享功能(iOS 篇)(二)
2017-10-11 14:38:53 】 浏览:7063
Tags:React Native 轻松 集成 分享 功能 iOS篇
ains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>sinajs.cn</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>sina.cn</key> <dict> <!-- 适配 iOS10 --> <key>NSExceptionMinimumTLSVersion</key> <string>TLSv1.0</string> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>weibo.cn</key> <dict> <!-- 适配 iOS10 --> <key>NSExceptionMinimumTLSVersion</key> <string>TLSv1.0</string> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>weibo.com</key> <dict> <!-- 适配 iOS10 --> <key>NSExceptionMinimumTLSVersion</key> <string>TLSv1.0</string> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <!-- 新浪微博--> </dict> </dict>

第三步:Usage 使用

import JShareModule from 'jshare-react-native';
JShareModule.setup(param)  // iOS 需要调用初始化函数, parm 这个参数
,需要填入应用注册信息,详情可以参考 API 文档

成功初始化后,就可以调用分享接口,我们先要构造消息对象,然后再调用 share()

 //
 // platformString:'wechat_session' / 微信好友(会话)
//                               'wechat_timeLine' /  微信朋友圈
//                               'wechat_favourite' / 微信收藏
//                               'qq' / QQ 好友
//                               'qzone' /   QQ 空间
//                               'sina_weibo' /  新浪微博
//                               'sina_weibo_contact'/ 新浪微博联系人
 //
 //
 // textMessage =
 // {
 //  type: 'text'
 //  platform: platformString  // 分享到指定平台
 //  text: String
 //  imagePath: // 选填,新浪微博本地图片地址,其他平台没有这个字段(iOS 不支持这个字段)
 // }
 // 
 // imageMessage =
 // {
 //  type: 'image'
 //  platform: platformString  // 分享到指定平台
 //  imagePath: String   // 本地图片路径 imagePath, imageUrl imageArray 必须三选一
 //  text: String  // 选填
 //  imageUrl: String // 网络图片地址,必须以 http 或 https 开头,imagePath, imageUrl imageArray 必须三选一 (iOS 不支持这个字段)
 //  imageArray: [String]  // (选填: 分享到 Qzone 才提供这个字段) 如果需要分享多张图片需要这个参数,数组中问题图片路径 imagePath, imageUrl imageArray 必须三选一
 // }
 // 
 // videoMessage =
 // {
 //   type: 'video'
 //   platform: platformString  // 分享到指定平台
 //   title: String // 选填
 //   url: String // 视频跳转页面 url
 //   text: String  // 选填
 //   imagePath: String // 选填,缩略图,本地图片路径
 //  
 //  videoUrl: String  // QQ 空间本地视频 (iOS 不支持这个字段)
 // }
 // 
 // audioMessage =
 // {
 //   type: 'audio'
 //   platform: platformString  // 分享到指定平台
 //   musicUrl: String //必填 点击直接播放的 url
 //   url: String //选填,点击跳转的 url
 //   imagePath: String   //选填,缩略图,本地图片路径,imagePath,imageUrl 必须二选一
 //   imageUrl: String // 选填,网络图片路径,imagePath, imageUrl 必须二选一
 //  title: String // 选填 
 //  text: String  // 选填
 // }
 // 
 // fileMessage =
 // {
 //   type: 'file'
 //   platform: platformString  // 分享到指定平台
 //   path: String // 必填,文件路径
 //   fileExt: String // 必填,文件类型后
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇UIDevice currentDevice model po.. 下一篇iOS Runtime原理及使用

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目