构建存档时未找到 Apple 框架 [英] Apple framework not found when building Archive

查看:27
本文介绍了构建存档时未找到 Apple 框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为使用 RealityKit 的现有应用添加对 AR 功能的可选支持.该应用程序在 iOS 10 和 iOS 13 设备上构建并运行良好,可选功能仅在后者中启用.但是,当我为通用 iOS 设备构建或尝试存档时,我在任何 import RealityKit 语句上收到错误 No such module 'RealityKit' 并且构建失败.

I'm trying to add optional support for an AR feature to an existing app using RealityKit. The app builds and runs fine on both iOS 10 and iOS 13 devices with the optional feature only enabled in the latter. However, when I build for a Generic iOS Device or try to Archive, I get an error No such module 'RealityKit' on any import RealityKit statement and the build fails.

该应用程序的构建目标是 iOS 10,RealityKit 在 iOS 13 中可用.我添加了守卫以仅在 @available(iOS 13.0, *) 和弱-在我的构建设置中使用 -weak_framework RealityKit 其他链接器标志链接 RealityKit 框架.

The build target for the app is iOS 10, with RealityKit being available in iOS 13. I've added guards to only build certain classes if @available( iOS 13.0, *) and weak-linked the RealityKit framework using a -weak_framework RealityKit Other Linker Flag in my Build Settings.

当我执行 Release 而不是 Debug 构建时会发生同样的事情,但我在方案设置中找不到任何差异.我没有使用 Pod,RealityKit 是 iOS 13 中引入的标准 Apple 框架.

Same thing happens when I do a Release instead of a Debug build, but I couldn't find any difference in the scheme settings. I'm not using pods and the RealityKit is a standard Apple framework introduced in iOS 13.

任何想法如何解决这个问题?

Any ideas how to get around this?

推荐答案

看起来解决这个问题的方法是使用 canImport(module) 预处理器指令.这对我有用:

Looks like the way around this issue is with a canImport(module) preprocessor directive. This worked for me:

#if canImport(RealityKit)

import RealityKit

@available(iOS 13.0, *)
class MyARClass {

    @IBOutlet weak var arView: ARView!

...
}

#endif

这篇关于构建存档时未找到 Apple 框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆