所有故事板、xib 文件都不会使用 rosetta 更新 Macbook Pro M1 上的框架或约束(与 IBAgent-iOS 通信时遇到错误)

All storyboard, xib file don't update the frame or constraint on Macbook Pro M1 with rosetta (Encountered an error communicating with IBAgent-iOS)

我尝试在我的项目中添加约束或加载一些故事板或 XIB 文件,但故事板没有更新并且看不到任何内容。 这是我的错误屏幕截图:

在第一张图片中,标签显示在模拟器中,但情节提要中没有显示。

在第二张图片中,.xib文件无法加载任何UI项

这是我的错误日志:

================================= DATE: =================================

Monday, 21 December 2020 at 14:22:27 Japan Standard Time 2020-12-21 05:22:27 +0000

================================= XCODE VERSION INFO: =================================

Version = 12.3 (12C33) Plugin Version = 17701 Beta Version = 1 OS Version = 11.1 (20C69)

================================= ERROR: =================================

Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (-1) failed to launch): Failed to launch IBAgent-iOS via CoreSimulator spawn (Failure reason: Failed to spawn IBAgent-iOS on iPhone 12 Pro Max (D81D1F57-170A-4089-843E-1D1E58B049C6, iOS 14.3, Booted)): Invalid device state

Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (-1) failed to launch, NSUnderlyingError=0x7fea6c306aa0 {Error Domain=com.apple.CoreSimulator.SimError Code=405 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedFailureReason=Failed to spawn IBAgent-iOS on iPhone 12 Pro Max (D81D1F57-170A-4089-843E-1D1E58B049C6, iOS 14.3, Booted), NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fea689e0de0 {Error Domain=com.apple.CoreSimulator.SimError Code=405 "Invalid device state" UserInfo={NSLocalizedDescription=Invalid device state}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}

================================= TOOL DESCRIPTION: =================================

<IBCocoaTouchPlatformToolDescription: 0x7feaaba355a0> { | targetRuntime.identifier: IBCocoaTouchFramework-fourteenAndLater | _roleString: System content | deviceTypeDescription: <IBSimulatorDeviceTypeDescription: 0x7fea6a16c000> deviceType=com.apple.CoreSimulator.SimDeviceType.iPhone-12-Pro-Max }

================================= LAUNCH CONTEXT: =================================

<IBCocoaTouchToolLaunchContext: 0x7fea6c3fbbb0> { | toolDescription.ib_verboseDescription: <IBCocoaTouchPlatformToolDescription: 0x7feaaba355a0> { | | targetRuntime.identifier: IBCocoaTouchFramework-fourteenAndLater | | _roleString: System content | | deviceTypeDescription: <IBSimulatorDeviceTypeDescription: 0x7fea6a16c000> deviceType=com.apple.CoreSimulator.SimDeviceType.iPhone-12-Pro-Max | } | launchPath: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBAgent-iOS | frameworkSearchPaths: ( "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks" ) | toolName: IBAgent-iOS | platformName: iphonesimulator | applicationTool: 0 | processIdentifier: -1 | exitStatus: (null) | signalStatus: (null) }

================================= EXECUTION CONTEXT: =================================

<IBSimulatorToolCoreSimulatorBootedCLIExecutionContext: 0x7fea6c11b010 busyCount=0, Idle for 0.0 secs> { | device: iPhone 12 Pro Max (D81D1F57-170A-4089-843E-1D1E58B049C6, iOS 14.3, Booted) }

================================= DEVICE: =================================

iPhone 12 Pro Max (D81D1F57-170A-4089-843E-1D1E58B049C6, iOS 14.3, Booted)

================================= TOOL MANAGER: =================================

<IBCocoaTouchToolManager: 0x7fea6a150100>

================================= REASON FOR REQUESTING TOOL: =================================

Preflighting tools for opening document <IBStoryboardDocument: 0x7fea69139a00>: <IBCocoaTouchTargetRuntime: 0x7fea6a1525d0>

================================= XCODE BACKTRACE: =================================

0 +[IBPlatformToolFailureHandler failureHandlerWithContext:failure:diagnosticsHandlerBlock:] (in IDEInterfaceBuilderKit) 1
+[IBAbstractInterfaceBuilderPlatformToolManager _THREADSAFE_injectDiagnosticsHandlerWithFailureContext:intoError:forLaunchingToolWithError:] (in IDEInterfaceBuilderKit) 2
+[IBAbstractInterfaceBuilderPlatformToolManager _THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:] (in IDEInterfaceBuilderKit) 3
__117-[IBAbstractInterfaceBuilderPlatformToolManager asyncLaunchNewToolWithDescription:queue:completionHandler:forReason:]_block_invoke.429 (in IDEInterfaceBuilderKit) 4 _dispatch_call_block_and_release (in libdispatch.dylib) 5 _dispatch_client_callout (in libdispatch.dylib) 6 _dispatch_lane_serial_drain (in libdispatch.dylib) 7 _dispatch_lane_invoke (in libdispatch.dylib) 8 _dispatch_workloop_worker_thread (in libdispatch.dylib) 9
_pthread_wqthread (in libsystem_pthread.dylib) 10 start_wqthread (in libsystem_pthread.dylib)

================================= SDKS: =================================

Simulator - watchOS 7.2 (watchsimulator7.2): version = 7.2 platform = com.apple.platform.watchsimulator versionInfo = { BuildID = "8D9D1CD2-32F3-11EB-B18E-209C67F7BDAB"; ProductBuildVersion = 18S561; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Watch OS"; ProductVersion = "7.2"; }

Simulator - watchOS 7.2 (watchsimulator7.2): version = 7.2 platform = com.apple.platform.watchsimulator versionInfo = { BuildID = "8D9D1CD2-32F3-11EB-B18E-209C67F7BDAB"; ProductBuildVersion = 18S561; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Watch OS"; ProductVersion = "7.2"; }

tvOS 14.3 (appletvos14.3): version = 14.3 platform = com.apple.platform.appletvos versionInfo = { BuildID = "E3F85AF8-32C4-11EB-9F1B-1F54C5D7F887"; ProductBuildVersion = 18K559; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Apple TVOS"; ProductVersion = "14.3"; }

Simulator - iOS 14.3 (iphonesimulator14.3): version = 14.3 platform = com.apple.platform.iphonesimulator versionInfo = { BuildID = "88F866D8-32D9-11EB-997E-99E30E3CEA69"; ProductBuildVersion = 18C61; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "iPhone OS"; ProductVersion = "14.3"; }

Simulator - tvOS 14.3 (appletvsimulator14.3): version = 14.3 platform = com.apple.platform.appletvsimulator versionInfo = { BuildID = "E3F85AF8-32C4-11EB-9F1B-1F54C5D7F887"; ProductBuildVersion = 18K559; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Apple TVOS"; ProductVersion = "14.3"; }

watchOS 7.2 (watchos7.2): version = 7.2 platform = com.apple.platform.watchos versionInfo = { BuildID = "8D9D1CD2-32F3-11EB-B18E-209C67F7BDAB"; ProductBuildVersion = 18S561; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Watch OS"; ProductVersion = "7.2"; }

Simulator - tvOS 14.3 (appletvsimulator14.3): version = 14.3 platform = com.apple.platform.appletvsimulator versionInfo = { BuildID = "E3F85AF8-32C4-11EB-9F1B-1F54C5D7F887"; ProductBuildVersion = 18K559; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Apple TVOS"; ProductVersion = "14.3"; }

macOS 11.1 (macosx11.1): version = 11.1 platform = com.apple.platform.macosx versionInfo = { ProductBuildVersion = 20C63; ProductCopyright = "1983-2020 Apple Inc."; ProductName = macOS; ProductUserVisibleVersion = "11.1"; ProductVersion = "11.1"; iOSSupportVersion = "14.3"; }

iOS 14.3 (iphoneos14.3): version = 14.3 platform = com.apple.platform.iphoneos versionInfo = { BuildID = "88F866D8-32D9-11EB-997E-99E30E3CEA69"; ProductBuildVersion = 18C61; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "iPhone OS"; ProductVersion = "14.3"; }

watchOS 7.2 (watchos7.2): version = 7.2 platform = com.apple.platform.watchos versionInfo = { BuildID = "8D9D1CD2-32F3-11EB-B18E-209C67F7BDAB"; ProductBuildVersion = 18S561; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Watch OS"; ProductVersion = "7.2"; }

iOS 14.3 (iphoneos14.3): version = 14.3 platform = com.apple.platform.iphoneos versionInfo = { BuildID = "88F866D8-32D9-11EB-997E-99E30E3CEA69"; ProductBuildVersion = 18C61; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "iPhone OS"; ProductVersion = "14.3"; }

macOS 11.1 (macosx11.1): version = 11.1 platform = com.apple.platform.macosx versionInfo = { ProductBuildVersion = 20C63; ProductCopyright = "1983-2020 Apple Inc."; ProductName = macOS; ProductUserVisibleVersion = "11.1"; ProductVersion = "11.1"; iOSSupportVersion = "14.3"; }

tvOS 14.3 (appletvos14.3): version = 14.3 platform = com.apple.platform.appletvos versionInfo = { BuildID = "E3F85AF8-32C4-11EB-9F1B-1F54C5D7F887"; ProductBuildVersion = 18K559; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "Apple TVOS"; ProductVersion = "14.3"; }

Simulator - iOS 14.3 (iphonesimulator14.3): version = 14.3 platform = com.apple.platform.iphonesimulator versionInfo = { BuildID = "88F866D8-32D9-11EB-997E-99E30E3CEA69"; ProductBuildVersion = 18C61; ProductCopyright = "1983-2020 Apple Inc."; ProductName = "iPhone OS"; ProductVersion = "14.3"; }

DriverKit 20.2 (driverkit.macosx20.2): version = 20.2 platform = com.apple.platform.macosx versionInfo = { }

请帮助我。

请重新启动 Xcode 并清理构建所有内容。它对我有用。

关闭模拟器应用。

重新启动xcode。

运行.

如果问题仍然存在,请在使用过的 SIM 卡上“清除内容和设置”。

确保安装了最新的 Xcode 版本。确保使用的命令行工具的版本适合使用的 X 代码版本(Xcode 首选项)。

我通过不使用 Rosetta 解决了这个问题。

没有使用 Rosetta。它对我有用。但是 Cocoapods 需要在 Macbook Pro M1 上使用 Rosetta。这让我发疯。希望这将在下一个 Xcode 版本中得到修复。

解决Apple Silicon上的问题:

  1. 启用 Rosetta 后,只需在构建设置部分的任何 iOS 模拟器 SDK 的排除架构中添加 arm64 并构建项目。

  2. 然后关闭 Xcode,禁用 Rosetta 并重新打开 Xcode。