当前位置:网站首页>AppClips&Tips(持续更新)
AppClips&Tips(持续更新)
2022-06-11 06:39:00 【我为双鱼狂】
事事无绝对,只怕有心人。没有解决不了的问题,不放弃,总是会解决的。
记录在开发过程中遇到的问题
今天已经圆满完成一个 appClips 的上线,在开发和上线过程中,记录了一些遇到的问题,以及如何解决。先放出来,给到需要的人,毕竟到处找解决的问题,也是费时不少。
下面的问题,可能记录的不全面,你在开发过程中遇到了什么问题,给我留言,看到后会给你解答。
问题1
新创建的的 clips,使用系统默认的启动页时,走的是 Main.storeboard 文件。在 application 中自定义设置也是无效的。如下代码,设置是无效的。
let homeNav = BaseNavigationController.init(rootViewController: type.init())
window?.rootViewController = homeNav
window?.makeKeyAndVisible()
如果想要上面的代码生效,需要在 info.plist 文件中删除 Application Scene Manifest 选项中的内容。
问题2
在 clips 中使用主项目的代码时,可以需要引入主项目中引入的第三方依赖。这时,需要在 Podfile 文件中设置 clips target 下的依赖,比如下:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'MW_APP_Swift' do
platform :ios, '10.0'
pod 'Alamofire'
end
target 'MW_APP_Clip' do
platform :ios, '14.0'
pod 'Alamofire'
end
文件中可以看到,Podfile 中的依赖是根据 target 走的,也就是在不同的 target 下,可以设置不同的依赖。
问题2-跟进
如何 Proflie 上的内容设置成如上,则会在编译的时候有一个 Warning,并在后面的 Archive 的时候报错,如下:
Xcode warning: Multiple targets match implicit dependency for product
实际的问题就是每一个 target 下设置了 platform,导致依赖的包都有两个不同的 platform。正确的处理方式,如下:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '13.0'
abstract_target 'abstract_pod' do
pod 'Alamofire'
pod 'SwiftyJSON'
target 'MW_APP_Swift' do
end
target 'MW_APP_Clip' do
end
end
就是 platform 设置成一个。abstract_target 是设置抽象 target。所以 abstract_pod 也是可以随便写。
Podfile 中可以设置多个 target 的依赖,参考链接如下所示:
iOS - 一个工程多个target引入CocoaPods的方式_九楼的博客-CSDN博客
问题 3
当运行 clips 的时候,可能会遇到 Unable to install "MW_APP_Clip 的提示。当查看详情的时候,会发现这样一段话:
Unable to install "MW_APP_Clip"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
DVTErrorCreationDateKey = "2022-04-20 07:02:30 +0000";
IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}
--
The code signature version is no longer supported.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
遇到这个问题,就要找到对应的 target,在 General 菜单中,下拉找到 Frameworks、Libraries...。先排查这里的 framework 都是需要的吗?把不需要的删除,然后看 Embeb 列中,选择 Do not Embed 。
问题4
如果主项目中有 MyProject-Bridging-Header.h 头文件时,在 Clip 的 target 中如何设置?
到主项目中的 Build Setting 中搜索 Bridging,会在搜索结果中看到主项目引用该头文件的路径。接下来就是复制这个路径,然后将这个路径粘贴到 clip 的 target 中相同的问题中。
也可以在 AppClip 项目中创建一个新的文件,MyProjectClip-Bridging-Header.h,然后在 AppClip 的 Build Setting 中找到 Bridging,填写路径。
问题 5
当在 clip 的 target 下对应的 Active Compilation Conditions 中添加 APPCLIP 后,就可以在代码中使用下面的宏来区分主项目和 clips 项目的代码。
#if !APPCLIP
// Code you don't want to use in your app clip.
#else
// Code your app clip may access.
#endif
如果设置之后没有作用,那么就看一下主项目中的 Active Compilation Conditions 中是不是也有 APPCLIP ? 如果有,就删除它。
问题 6
当 archive 完包含 app clip 的应用后,上传到 app store,会返回一个警告(错误):
ITMS-90876: Missing entitlement - This app contains an app clip. The entitlement 'com.apple.developer.associated-appclip-app-identifiers' should be present and include the value of the app clip's application identifier.
暂未解决
虽然有这样的提示,但是上线后,扫码使用 app clips 没有任何影响,暂时定为是苹果的锅。暂时不用解决。
问题 7
在构建版本页面,设置“编辑高级体验“时,设置的 url,绑定了唯一的 appId,无法在其他的 appId 中去设置”编辑高级体验“。如何解除绑定?
暂未解决
这个问题一定要重视,需要扫码触发 app clips,就必须要设置“编辑高级体验”。所以目前来说一个 url 只能唯一绑定一个 appId。所以在设置之前要慎重慎重再慎重。
边栏推荐
- JVM from getting started to giving up 2: garbage collection
- A collection of problems on improving working frequency and reducing power consumption in FPGA design
- Human gene editing technology and ethical issues behind it [personal view, for reference only]
- MMEditing中超分模型训练与测试
- About the principle and code implementation of Siou (review IOU, giou, Diou, CIO)
- Convert text label of dataset to digital label
- break,continue有什么区别和用法?
- Redux learning (II) -- encapsulating the connect function
- JVM from getting started to abandoning 1: memory model
- 解决ffmpeg获取AAC音频文件duration不准
猜你喜欢

jenkins-不同风格的项目构建

Communication between different VLANs

C language war "minesweeping"

Jenkins voucher management

通过R语言且只用基础package来制作一个小游戏

UEFI查找PCI设备

Teach everyone how to implement an electronic signature

MongoDB安装

修复鼠标右键没有vscode快捷入口的问题
![Resolve typeerror: ctx injections. tableRoot.$ scopedSlots[ctx.props.column.slot] is not a function](/img/29/de95cef86bd75107555b212f01ebb9.jpg)
Resolve typeerror: ctx injections. tableRoot.$ scopedSlots[ctx.props.column.slot] is not a function
随机推荐
[TP5 online export picture generation excel detailed explanation example]
Communication between different VLANs
022 basic introduction to redis database 0
538.把二叉搜索树转换成累加树
解决ffmpeg获取AAC音频文件duration不准
JVM from getting started to abandoning 1: memory model
QT socket setting connection timeout
Error code in ijkplayer
Résoudre le problème de la durée inexacte du fichier audio AAC obtenu par ffmpeg
Mediaextractor source code analysis of multimedia framework analysis (1)
Redux learning (I) -- the process of using Redux
关于SIoU的原理和代码实现(回顾IoU、GIoU、DIoU、CIoU)
懒加载,预加载
Jenkins voucher management
Learn a trick to use MySQL functions to realize data desensitization
A piece of code has been refactored six times by the boss, and my mind is broken
How exactly does instanceof judge the reference data type!
C language war "minesweeping"
Shandong University machine learning experiment 7 pca+ SVM face recognition
争议很大的问题