参考:
通用链接 https://www.cnblogs.com/guoshaobin/p/11164000.html
OC调JS https://forum.cocos.org/t/cocos-creator-oc-js/55764/8
cocoscreator
接入微信登录https://blog.csdn.net/weixin_44926736/article/details/91047069
微信分享 https://www.jianshu.com/p/c2c950542c18
微信开放平台文档 https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html
一、Cocos Creator 构建项目
构建发布-构建+编译即可得到源码,源码位置:
frameworks->runtime-src->proj.ios_mac
二、配置项目相关
1、微信SDK包拖入工程
2、target->info->URLType 添加
idenifier:weixin
URL Schemes:wx1111111111111111(这里是微信开放平台申请的id)
3、target->info 标签栏添加
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
4、build Settings->other Linker flags 添加微信包路径
$(PROJECT_DIR)/WX/libWeChatSDK.a
build settings->search Paths HeaderSearch、LibrarySearch、User Header添加
$(PROJECT_DIR)/WX
三、配置UniversalLinks
(1.配置一个https链接,制作名为apple-app-site-association的无后缀json文件,内容如下
{
"applinks":{
"apps":[],
"details":[
{
"appID":TeamId.BundleId,
"paths":["*"]
}
]
}
}
将该文件上传到paths,这里是根目录,paths具体到话需要在后面加通配符/*
appID为Team.BundleId
(2.Signing&Capability -> Associated Domains
添加:
applinks:域名
(3.Apple Developer
Member Center - Certificates, Identifiers & Profiles – Identifiers - App IDs –Edit开启Associated Domains 需要重新制作provision
(4.在AppController.mm里实现
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable)