阿里云 ip 网站,品牌建设网站公司排名,静态网页素材,家具商务网站策划案前言
iOS 开发者 最憋屈的就是UI 布局慢,一直以来没有实时预览功能,虽然swiftUI 早就支持了,但是目前主流还是使用UIKit在布局,iOS 17 苹果推出了 #Preview 可以支持UIKit 实时预览,但是仅仅是 iOS 17,老项目怎么办呢?于是就有了这篇 老项目适配 #Preview 预览 的文章,…前言
iOS 开发者 最憋屈的就是UI 布局慢,一直以来没有实时预览功能,虽然swiftUI 早就支持了,但是目前主流还是使用UIKit在布局,iOS 17 苹果推出了 #Preview 可以支持UIKit 实时预览,但是仅仅是 iOS 17,老项目怎么办呢?于是就有了这篇 老项目适配 #Preview 预览 的文章,从新建 Targets 是正文开始,前面的是我在探索过程中的踩坑记录。
环境 MacOS: 15.1 Apple: M4 Xcode: 16.1
一、AlipaySDK 报错
错误日志 PREVIEW UPDATE ERROR: FailedToLaunchAppError: Failed to launch com.xxx.xxx XOJITError: x86_64 slice of /Users/xxx/Documents/YLProject/poetry/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK does not contain an archive
解决
更新 Podfile 配置:post_install do |installer|installer.pods_project.targets.each do |target|target.build_configurations.each do |config|# Needed for building for simulator on M1 Macsconfig.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'endend
end清理并重新安装依赖pod deintegrate
pod install二、ProjectWidgetExtension 小组件中报错
错误日志 Could not find module ‘WebPKit’ for target ‘arm64-apple-ios-simulator’; found: x86_64-apple-ios-simulator, at: /Users/liyanhong/Library/Developer/Xcode/DerivedData/poetry-fgnfhoqfwdsbnpaudqkcloqdigxt/Index.noindex/Build/Products/Debug-iphonesimulator/WebPKit/WebPKit.framework/Modules/WebPKit.swiftmodule
解决 在 ProjectWidgetExtension 的 Build Settings 中,手动排除模拟器架构: 1. 打开 Build Settings。 2. 搜索 Excluded Architectures。 3. 在 Any iOS Simulator SDK 中添加 arm64。