Apple framework not found when building Archive

爱⌒轻易说出口 提交于 2021-02-05 10:45:11

问题


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.

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.

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?


回答1:


Check your project setting by going to Build Settings, find Framework Search Paths and add $(SRCROOT) and be sure it's recursive.




回答2:


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


来源:https://stackoverflow.com/questions/58688174/apple-framework-not-found-when-building-archive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!