我尝试在 Xcode 15 中使用 #Preview 宏预览 UIKit 视图,但收到此错误
== PREVIEW UPDATE ERROR:
FailedToLaunchAppError: Failed to launch
==================================
| RemoteHumanReadableError: The operation couldn’t be completed. Transaction failed. Process failed to launch. (process launch failed)
|
| BSTransactionError (1):
| ==error-reason: process launch failed
| ==transaction: <FBApplicationProcessLaunchTransaction: 0x600003b287e0>
| ==precipitating-error: Error Domain=FBProcessExit Code=64 "The process failed to launch." UserInfo={NSLocalizedFailureReason=The process failed to launch., BSErrorCodeDescription=launch-failed, NSUnderlyingError=0x600000c1ad90 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600000c1aee0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}}
| ==error-description: Process failed to launch.
| ==NSLocalizedFailureReason: Transaction failed. Process failed to launch. (process launch failed)
我正在尝试在 iPhone 15 上预览代码
import UIKit
final class SomeViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
}
@available(iOS 17, *)
#Preview {
SomeViewController()
}