Eug*_*e P 6 swiftui swiftui-previews
在我的框架内运行SwiftUI视图预览时遇到问题。\n这是一个项目结构。
主目标(ContentView、GradientView)中的 SwiftUI 视图预览按预期工作。
\n但是,当我\xe2\x80\x99m 尝试预览UI.xcodeproject(SwiftUIView )内的视图时,我\xe2\x80\x99m 收到错误
\n\nPotentialCrashError: Update failed\n\nXCPreviewAgent may have crashed. Check ~/Library/Logs/DiagnosticReports for any crash logs from your application.\n\n==================================\n\n| RemoteHumanReadableError\n| \n| LoadingError: failed to load library at path "/Users/yevgeniy/Library/Developer/Xcode/DerivedData/Hackathon-abjguuvpzyisdncwvpeguazdifiu/Build/Intermediates.noindex/Previews/Hackathon/Intermediates.noindex/UI.build/Debug-iphonesimulator/UI.build/Objects-normal/x86_64/SwiftUIView.1.preview-thunk.dylib": Optional(dlopen(/Users/yevgeniy/Library/Developer/Xcode/DerivedData/Hackathon-abjguuvpzyisdncwvpeguazdifiu/Build/Intermediates.noindex/Previews/Hackathon/Intermediates.noindex/UI.build/Debug-iphonesimulator/UI.build/Objects-normal/x86_64/SwiftUIView.1.preview-thunk.dylib, 0x0002): tried: \'/Users/yevgeniy/Library/Developer/Xcode/DerivedData/Hackathon-abjguuvpzyisdncwvpeguazdifiu/Build/Intermediates.noindex/Previews/Hackathon/Products/Debug-iphonesimulator/SwiftUIView.1.preview-thunk.dylib\' (errno=2), \'/Applications/Xcode_14.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/yevgeniy/Library/Developer/Xcode/DerivedData/Hackathon-abjguuvpzyisdncwvpeguazdifiu/Build/Intermediates.noindex/Previews/Hackathon/Intermediates.noindex/UI.build/Debug-iphonesimulator/UI.build/Objects-normal/x86_64/SwiftUIView.1.preview-thunk.dylib\' (errno=2), \'/Users/yevgeniy/Library/Developer/Xcode/DerivedData/Hackathon-abjguuvpzyisdncwvpeguazdifiu/Build/Intermediates.noindex/Previews/Hackathon/Intermediates.noindex/UI.build/Debug-iphonesimulator/UI.build/Objects-normal/x86_64/SwiftUIView.1.preview-thunk.dylib\' (mach-o file, but is an incompatible architecture (have \'x86_64\', need \'arm64\')))\n| \n| ==================================\n| \n| | MessageSendFailure: Message send failure for <ServiceMessage 115: update>\nRun Code Online (Sandbox Code Playgroud)\n~/Library/Logs/DiagnosticReports 文件夹为空。
\n在Rosetta模式下使用Xcode 14.0。
\nRosetta模式下的Xcode 14.1 - 同样的问题
\n没有 Rosetta 的相同配置也可以正常工作。(在我的产品项目中,由于第 3 方依赖,我必须使用 Rosetta)
\n为活动架构构建设置为NO
为 Active 架构构建不会YES改变任何内容
所有常见的事情都尝试过:
\n\n\nRun Code Online (Sandbox Code Playgroud)\nThe answer to those who came here with the same problem: \n\nIf you have to run in **Rosetta** mode, keep checking this post.\n\nOtherwise, run without **Rosetta**, that will solve your problem.\n
我遇到了同样的问题。基于 M1Pro 构建,未安装 Rosetta。iOS 项目。预览工作正常,然后在我移动一些代码以适应所需的应用程序结构(不是我的)后的一天停止了。预览错误指示一个特定的 swift 源文件,但当我将其复制到另一个项目时,它完美地编译和预览。
| 归档时间: |
|
| 查看次数: |
1014 次 |
| 最近记录: |