“Expansion of macro ‘ObservationTracked’ produced an unexpected ‘init’ accessor.”

huangapple go评论103阅读模式
英文:

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

问题

After updating Xcode to 15 beta 3, errors started appearing on the var properties of my @Observable models when building my project for Apple Vision Pro.

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

There's also this error. I think it's related:

> External macro implementation type 'ObservationMacros.ObservableMacro' could not be found for macro 'Observable()'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library'

英文:

After updating Xcode to 15 beta 3, errors started appearing on the var properties of my @Observable models when building my project for Apple Vision Pro.

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

There's also this error. I think it's related:

> External macro implementation type 'ObservationMacros.ObservableMacro' could not be found for macro 'Observable()'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library'

答案1

得分: 3

显然,Xcode 15 beta 3对于这个特定情况引入了回归。如发布说明中所述。

  • 使用@Observable属性包装器的visionOS项目将无法在Xcode 15 beta 3中构建。(111494849)
    解决方法:继续使用Xcode 15 beta 2。

如果您正在为Apple Vision Pro制作应用程序并使用新的Observation框架,最好远离第三个beta版本,坚持使用Xcode 15 beta 2。

编辑:看起来beta 5现在可以工作了。请确保Xcode应用程序名称中没有空格,正如@Jari所提到的。

英文:

Apparently, Xcode 15 beta 3 introduced a regression for this specific case. As mentioned in the 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.

If you are making an app for Apple Vision Pro and are making use of the new Observation framework, you better stay away from the third beta and stick to Xcode 15 beta 2.

EDIT: It looks like beta 5 works now. Please make sure there's no space in the Xcode app name as @Jari mentioned.

答案2

得分: 1

确保Xcode应用程序的文件名中没有空格。将应用程序文件从“Xcode-beta 2”重命名为“Xcode-beta-2”解决了我遇到的宏丢失问题。

英文:

Make sure you don't have spaces in the filename of the Xcode app. Renaming the app file from "Xcode-beta 2" to "Xcode-beta-2" fixed the missing macro issue for me.

huangapple
  • 本文由 发表于 2023年7月6日 20:24:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628813.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定