func createEnvironmentResource(image:UIImage) -> EnvironmentResource? {
do {
let cube = try TextureResource(
cubeFromEquirectangular: image.cgImage!,
quality: .normal,
options: TextureResource.CreateOptions(semantic: .hdrColor)
)
let environment = try EnvironmentResource(
cube: cube,
options: EnvironmentResource.CreateOptions(
samplingQuality: .normal,
specularCubeDimension: cube.width/2
// compression: .astc(blockSize: .block4x4, quality: .high)
)
)
return environment
}catch{
print("error: \(error)")
}
return nil
}
When I put this code in the project, it can run normally on the visionOS 2.0 simulator. When it is run on the real machine, an error is reported at startup:
dyld[987]: Symbol not found: _$s10RealityKit19EnvironmentResourceC4cube7optionsAcA07TextureD0C_AC0A10FoundationE13CreateOptionsVtKcfC
Referenced from: <DEC8652C-109C-3B32-BE6B-FE634EC0D6D5> /private/var/containers/Bundle/Application/CD2FAAE0-415A-4534-9700-37D325DFA845/HomePreviewDEV.app/HomePreviewDEV.debug.dylib
Expected in: <403FB960-8688-34E4-824C-26E21A7F18BC> /System/Library/Frameworks/RealityFoundation.framework/RealityFoundation
What is the reason and how to solve it ?
Hello @xuhengfei,
Please make sure that your device is updated to the latest visionOS beta, and that you are building your app with the latest Xcode 16 beta. Then, if you still encounter this issue, please file a bug report using Feedback Assistant.
Best regards,
Greg