{"id":14988489,"url":"https://github.com/vilicvane/cordova-plugin-wechat","last_synced_at":"2025-12-17T10:04:40.210Z","repository":{"id":25134507,"uuid":"28556596","full_name":"vilicvane/cordova-plugin-wechat","owner":"vilicvane","description":"Cordova 微信分享插件","archived":false,"fork":false,"pushed_at":"2016-01-18T12:47:20.000Z","size":6179,"stargazers_count":172,"open_issues_count":14,"forks_count":53,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-10-31T04:55:13.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vilicvane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-28T07:40:00.000Z","updated_at":"2025-08-25T15:16:05.000Z","dependencies_parsed_at":"2022-08-20T19:40:15.644Z","dependency_job_id":null,"html_url":"https://github.com/vilicvane/cordova-plugin-wechat","commit_stats":null,"previous_names":["vilicvane/cordova-plugin-wechat","vilic/cordova-plugin-wechat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vilicvane/cordova-plugin-wechat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vilicvane%2Fcordova-plugin-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vilicvane%2Fcordova-plugin-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vilicvane%2Fcordova-plugin-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vilicvane%2Fcordova-plugin-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vilicvane","download_url":"https://codeload.github.com/vilicvane/cordova-plugin-wechat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vilicvane%2Fcordova-plugin-wechat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27781474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:16:48.311Z","updated_at":"2025-12-17T10:04:40.192Z","avatar_url":"https://github.com/vilicvane.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cordova/PhoneGap 微信分享插件\r\n\r\n此插件暂停维护, 如果不需要 WP 平台支持, 请使用 https://github.com/xu-li/cordova-plugin-wechat.\r\n\r\nInspired by https://github.com/xu-li/cordova-plugin-wechat\r\n\r\n支持 iOS, WP, Android, 都有回调. 分享内容只支持文本, 图片, 和链接.\r\n\r\n**另外需要注意的是 Android 不仅需要审核通过, 还需要那什么签名吻合, 所以得要 release 的 keystore 来签名.**\r\n关于这个问题写了个指南, 如果 Android 搞不定的可以看看\r\n[Android 微信 SDK 签名问题](https://github.com/vilic/cordova-plugin-wechat/wiki/Android-%E5%BE%AE%E4%BF%A1-SDK-%E7%AD%BE%E5%90%8D%E9%97%AE%E9%A2%98).\r\n\r\n## 安装\r\n\r\n一定不要忘记加上后面的 `--variable APP_ID=********`.\r\n\r\n```sh\r\ncordova plugin add cordova-plugin-tx-wechat --variable APP_ID=[你的APPID]\r\n```\r\n\r\n另外貌似 Cordova 的变量信息是按平台保存的, 如果安装插件时尚未添加某个平台, 即便之前加上了变量,\r\n之后添加平台时依旧会报错. 此时可以先卸载插件, 添加平台后带上变量重新安装.\r\n\r\n如果是 Visual Studio Tools for Apache Cordova, 可以这样配置 App ID:\r\n\r\n```xml\r\n\u003cvs:plugin name=\"cordova-plugin-tx-wechat\" version=\"0.3.1\"\u003e\r\n    \u003cparam name=\"APP_ID\" value=\"[你的APPID]\" /\u003e\r\n\u003c/vs:plugin\u003e\r\n```\r\n\r\n## 配置\r\n\r\n其实安装后就可以用了! 零配置哟哈哈哈! 下面列一些注意事项.\r\n\r\n### config.xml\r\n\r\n**可能**需要添加一些权限, 比如安卓貌似是要添加这些:\r\n\r\n```xml\r\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\r\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\r\n\u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u003e\r\n\u003cuses-permission android:name=\"android.permission.READ_PHONE_STATE\" /\u003e\r\n\u003cuses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" /\u003e\r\n\u003cuses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" /\u003e\r\n```\r\n\r\n反正我没添加, debug/release 都没问题, 不知道提交商店会不会有情况.\r\n\r\n### iOS 相关: libWeChatSDK.a\r\n\r\nsrc/ios/libWeChatSDK.a 这个文件有两个版本, 一个是 iPhone Only 的, 要小一些, 应该是最后生产环境用的.\r\n我放进去的是完整版本, 要大一倍 (应该是包含了 x86 架构方便模拟器 debug), 可以自己去下载\r\n[官方 SDK](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\u0026t=resource/res_list)\r\n然后替换掉 platforms/ios/应用名称/Plugins 目录下的 libWeChatSDK.a.\r\n\r\n## 使用\r\n\r\n```javascript\r\n// 在 device ready 后.\r\n\r\n// 分享 API\r\nWeChat\r\n    .share('文本', WeChat.Scene.session, function () {\r\n        console.log('分享成功~');\r\n    }, function (reason) {\r\n        console.log(reason);\r\n    });\r\n\r\n// 或者 (更多选项见后).\r\nWeChat\r\n    .share({\r\n        type: WeChat.ShareType.webpage,\r\n        title: '链接',\r\n        description: '链接描述',\r\n        url: 'https://wordsbaking.com/'\r\n    }, WeChat.Scene.timeline, function () {\r\n        console.log('分享成功~');\r\n    }, function (reason) {\r\n        // 分享失败\r\n        console.log(reason);\r\n    });\r\n\r\n// 检查微信安装情况\r\n// WP 始终返回 true\r\nWeChat\r\n    .isInstalled(function(installed) {\r\n        console.log('WeChat installed='+installed);\r\n    }, function(reason) {\r\n        console.log(reason);\r\n    });\r\n```\r\n\r\n## API 定义\r\n\r\n```typescript\r\ndeclare module WeChat {\r\n    /** 分享场景 */\r\n    enum Scene {\r\n        /** 用户自选, 安卓不支持 */\r\n        chosenByUser,\r\n        /** 聊天 */\r\n        session,\r\n        /** 朋友圈 */\r\n        timeline\r\n    }\r\n\r\n    /** 多媒体分享类型, 目前只支持 image, webpage */\r\n    enum ShareType {\r\n        app = 1,\r\n        emotion,\r\n        file,\r\n        image,\r\n        music,\r\n        video,\r\n        webpage\r\n    }\r\n    \r\n    /** 分享选项 */\r\n    interface IMessageOptions {\r\n        /** 多媒体类型, 默认为 webpage */\r\n        type: ShareType;\r\n        /** 标题 */\r\n        title?: string;\r\n        /** 描述 */\r\n        description?: string;\r\n        /** 缩略图的 base 64 字符串 */\r\n        thumbData?: string;\r\n        /** 分享内容的 url, type 为 image 是就是图片的 url, 为 webpage 时就是链接的 url */\r\n        url?: string;\r\n        /** 分享内容的 base 64 字符串, 与 url 二选一 */\r\n        data?: string;\r\n    }\r\n\r\n    // 分享.\r\n    function share(text: string, scene: Scene, onfulfilled: () =\u003e void, onrejected: (reason) =\u003e void): void;\r\n    function share(options: IMessageOptions, scene: Scene, onfulfilled: () =\u003e void, onrejected: (reason) =\u003e void): void;\r\n}\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvilicvane%2Fcordova-plugin-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvilicvane%2Fcordova-plugin-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvilicvane%2Fcordova-plugin-wechat/lists"}