# cordova-plugin-wechat **Repository Path**: lzw/cordova-plugin-wechat ## Basic Information - **Project Name**: cordova-plugin-wechat - **Description**: phonegap微信插件 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2014-06-08 - **Last Updated**: 2024-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README cordova-plugin-wechat =============== phonegap微信插件 Feature =============== 1. 支持分享到微信朋友圈 2. 支持分享到微信好友 3. 支持ios和android平台 Example =============== ~~See [cordova-plugin-wechat-example](https://github.com/xu-li/cordova-plugin-wechat-example)~~ Install(iOS) =============== 1. 参考[微信开放平台](https://open.weixin.qq.com/cgi-bin/frame?t=resource/res_main_tmpl&lang=zh_CN)将wechat库文件和头文件导入xcode项目 2. ```cordova plugin add https://github.com/xu-li/cordova-plugin-wechat``` 3. 编辑 ```config.xml```, 添加如下内容: ```XML ``` 4. 创建插件目录: ``` mkdir platforms/ios/whhe/Plugins/xu.li.cordova.wechat cp plugins/xu.li.cordova.wechat/src/ios/CDVWechat.* platforms/ios/whhe/Plugins/xu.li.cordova.wechat/ ``` 5. ```cordova build ios``` (it will fail if you haven't include the wechat lib yet.) Usage =============== ```Javascript Wechat.share({ message: { title: "Message Title", description: "Message Description(optional)", mediaTagName: "Media Tag Name(optional)", thumb: "http://YOUR_THUMBNAIL_IMAGE", media: { type: Wechat.Type.WEBPAGE, // webpage webpageUrl: "https://github.com/xu-li/cordova-plugin-wechat" // webpage } }, scene: Wechat.Scene.TIMELINE // share to Timeline }, function () { alert("Success"); }, function (reason) { alert("Failed: " + reason); }); ``` Arguments =============== ```Javascript Scene: { SESSION: 0, // 聊天界面 TIMELINE: 1, // 朋友圈 FAVORITE: 2 // 收藏 }, Type: { APP: 1, EMOTION: 2, FILE: 3, IMAGE: 4, MUSIC: 5, VIDEO: 6, WEBPAGE: 7 }, ``` FAQ =============== Q: "Wechat not installed", even installed A: Please make sure "wechatappid" is added in ```config.xml``` Q: platforms/ios/whhe/Plugins/xu.li.cordova.wechat/CDVWechat.m编译报错: "File not found" A: cp plugins/xu.li.cordova.wechat/src/ios/CDVWechat.* platforms/ios/whhe/Plugins/xu.li.cordova.wechat/ TODO =============== 1. ~~Add android version~~ 2. ~~Share to wechat session(聊天) and wechat favorite(收藏)~~ 3. Add other media types, including music etc. LICENSE =============== [MIT LICENSE](http://opensource.org/licenses/MIT)