Xcode 15 Beta 3 (15A5195k) HelloWorld failed to build

This is the HelloWorld project from https://developer.apple.com/documentation/visionos/world

In ViewModel.swift, there are tons of:

Expansion of macro 'ObservationTracked' produced an unexpected 'init' accessor

I got this even after "Clean Build Folder"

I am getting this same error on the Destination Video example project

Hello, I haven’t verified it yet, but this might be linked to the following known issue from Xcode 15 beta 3 release notes :

visionOS projects that use the @Observable property wrapper will fail to build in Xcode 15 beta 3. (111494849)
Workaround: Continue using Xcode 15 beta 2.

This issue is listed in the beta 3 release note. And the workaround is to keep using beta 2....

Looks like the @Observable macro is broken in beta 3 if you target visionOS. If you download the Observation sample project, it builds fine as is. However as soon as you add visionOS as a target and build for the visionOS simulator, the same error appears.

Just filed this as FB12538400. Please file a Feedback on this as well, so that this can get fixed in the next beta.

Same error on the Diorama sample.

I am evaluating Xcode Version 15.0 beta 4 (15A5195m). Same problem.

Yup, beta 4 has the same problem

Solution: Using @Observable on a class that has a property that is a closure causes the Xcode beta 3/4 compiler to flip out. Using @ObservationIgnored on the said property will get the compiler to calm down.

update the Viewmodel code to this:


@Observable class ViewModel {
    
    // MARK: - Navigation
    @ObservationIgnored var navigationPath: [Module] = []
    @ObservationIgnored var titleText: String = ""
    @ObservationIgnored var isTitleFinished: Bool = false
    @ObservationIgnored var finalTitle: String = "Hello World"

    // MARK: - Globe
    @ObservationIgnored var isShowingGlobe: Bool = false
    @ObservationIgnored var globeEarth: EarthEntity.Configuration = .globeEarthDefault
    @ObservationIgnored var isGlobeRotating: Bool = false
    @ObservationIgnored var globeTilt: GlobeTilt = .none

    // MARK: - Orbit
    @ObservationIgnored var isShowingOrbit: Bool = false
    @ObservationIgnored var orbitEarth: EarthEntity.Configuration = .orbitEarthDefault
    @ObservationIgnored var orbitSatellite: SatelliteEntity.Configuration = .orbitSatelliteDefault
    @ObservationIgnored var orbitMoon: SatelliteEntity.Configuration = .orbitMoonDefault

    // MARK: - Solar System
    @ObservationIgnored var isShowingSolar: Bool = false
    @ObservationIgnored var solarEarth: EarthEntity.Configuration = .solarEarthDefault
    @ObservationIgnored var solarSatellite: SatelliteEntity.Configuration = .solarTelescopeDefault
    @ObservationIgnored var solarMoon: SatelliteEntity.Configuration = .solarMoonDefault

    @ObservationIgnored var solarSunDistance: Double = 700
    @ObservationIgnored var solarSunPosition: SIMD3<Float> {
        [Float(solarSunDistance * sin(solarEarth.sunAngle.radians)),
         0,
         Float(solarSunDistance * cos(solarEarth.sunAngle.radians))]
    }
}

gillesduif,

Confirmed! It compiled!

But when running at the Simulator I got:

nw_socket_copy_info [C1:2] getsockopt TCP_INFO failed 102

nw_socket_copy_info getsockopt TCP_INFO failed 102

AddInstanceForFactory: No factory registered for id <CFUUID 0x600003c24540> F8BB1C28-BAE8-11D6-9C31-00039315CD46

Class for component AccessibilityComponent already registered

Class for component ImageBasedLightComponent already registered

Component Shadow already registered

Component Shadow already registered

Unexpected CARE Entity state: CALayerClientComponent destroyed unexpectedly in the app. layerId: 6.611.696.850.093.839.007, contextId: 0, name: _MRUIPlatterOrnamentBackingWindow (com.example.apple-samplecode.World9X2AS5344F)

Unexpected CARE Entity state: CALayerClientComponent destroyed unexpectedly in the app. layerId: 9.506.802.391.458.032.199, contextId: 0, name: _MRUIPlatterOrnamentBackingWindow (com.example.apple-samplecode.World9X2AS5344F)

The app at the simulator freezes, there is no World only an empty window.

Xcode 15.0 beta 4 (15A5195m) macOS 14.0 Beta (23A5286i)

when replacing the code in modelvew as suggested clears the compiler errors everyone is experiencing but nothing shows when the build is running the apps on visionPro simulator

running the apps producing these errors but nothing becomes visible in the simulator

nw_socket_copy_info [C1:2] getsockopt TCP_INFO failed 102 nw_socket_copy_info getsockopt TCP_INFO failed 102 AddInstanceForFactory: No factory registered for id <CFUUID 0x6000002723e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46

I can confirm that I am still receiving the following error in the "Hello World", "DestinationVideo" and "Diorama" Demo's in Xcode Version 15.0 beta 4 (15A5195m):

Expansion of macro 'ObservationTracked' produced an unexpected 'init' accessor

The "HappyBeam" Demo is the only one that currently runs.

Hi All,

It looks like the culprit is the Xcode beta4 Vision Pro Simulator. Try this: create an app using the Multiplatform template, change nothing, compile and send it to the Vison Pro simulator. It will freeze the same way Hello World freezes. Same happens with the Backyard Birds code sample from Apple. I guess it is also linked with the problems in the Preview window in Beta4. Better wait for Xcode beta5.

Regards, Johel

Diorama sample still fails to build using Xcode 15.0 beta 5

Hi All,

Xcode 15.0 beta 5 working better than previous versions. Hello World as published by Apple compiles and runs on Apple Vision Pro simulator. Same for the Multiplatform template test. Hello World still crashes here when I choose the View Globe or View Orbits or View Outer Space buttons. Error is:

     } catch {
        fatalError("Failed to load a model asset.")
    }

Xcode 15.0 beta 5 (15A5209g) macOS Sonoma 14.0 Beta (23A5301g) Mac mini 2018 16gB RAM (Intel processor)

Regards, Johel

Running Hello World in Xcode 15 beta 5 on a M1 Max still crashes and adding @ObervationIgnored just increases the errors. Ultimately I just refactored ViewModel to @ObservableObject and converted all instances to @ObservedObjects. It required a number of other tweaks too, but those were the primary changes.

Hi All,

There is a new version of HelloWord at https://developer.apple.com/documentation/visionOS/World

All those problems listed before are from the first version from June 16 2023. The new version is from July 14 2023. It compiles with no problems and runs at the simulator also with no problems.

Download it and enjoy.

BTW, that's a fantastic app!

Xcode 15.0 beta 5 (15A5209g) macOS Sonoma 14.0 Beta (23A5301g) Mac mini 2018 16gB RAM (Intel processor)

Regards, Johel

Xcode 15.0 beta 6 now breaks this again with the same error. Beta 5 worked fine. Apple has now deleted all release notes from beta 1 - 5, and no longer allows you to download any other version other then Xcode 15.0 beta 6. Good one apple...

Xcode 15 Beta 3 (15A5195k) HelloWorld failed to build
 
 
Q