Support
Quality
Security
License
Reuse
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
Get all kandi verified functions for this library.
Image tracking
Save and load maps
Detect objects
Environmental texturing
QUESTION
RealityKit app and lower iOS deployment target
Asked 2022-Mar-10 at 15:04I have an iOS app with deployment target iOS 10+, I need to add some features that depend only on RealityKit to appear with users whom their iOS version is 13+, the app compiles and runs successfully on real device but the problem is when archiving for upload to AppStore it generates a Swift file and says:
// "No such module RealityKit"
Sure the reason is related to iOS versions <13.0 but I can't edit that file (to add canImport
to RealityKit) it's read-only.
My question is how to cross this problem and make it archive successfully with lower versions support?
Here is a demo that shows the problem when archiving Demo.
ANSWER
Answered 2022-Mar-10 at 15:04Do not include Reality Composer's .rcproject
files in your archive for distribution. .rcproject
bundles contain the code with iOS 13.0+ classes, structs and enums. Instead, supply your project with USDZ files.
To allow iOS 13+ users to use RealityKit features, but still allow non-AR users to run this app starting from iOS 10.0, use the following code:
import UIKit
#if canImport(RealityKit)
import RealityKit
import Combine
@available(iOS 13.0, *)
class ViewController: UIViewController {
var arView = ARView(frame: .zero)
override func viewDidLoad() {
super.viewDidLoad()
arView.frame = self.view.frame
self.view.addSubview(arView)
let entity = ModelEntity(mesh: .generateBox(size: 0.1))
let anchor = AnchorEntity(world: [0,0,-2])
anchor.addChild(entity)
arView.scene.anchors.append(anchor)
}
}
#else
import SceneKit
#endif
Deployment target is iOS 10.0:
Thirdly :When publishing to the AppStore (in case we have a deployment target lower than iOS 13.0), we must make the import of this framework weakly linked
in the build settings (that's because RealityKit is deeply integrated in iOS and Xcode).
So, go to Build Settings –> Linking -> Other linker Flags.
Double-click it, press +, and paste the following command:
-weak_framework RealityKit -weak_framework Combine
OTHER_LDFLAGS = -weak_framework RealityFoundation
So, go to Build Settings –> Framework Search Paths.
Then type there the following command:
$(SRCROOT)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Find more information at:
Save this library and start creating your kit
See Similar Libraries in
Save this library and start creating your kit
Open Weaver – Develop Applications Faster with Open Source