应用程序无法在模拟器或存档上 运行,设备可以运行

App doesn't run on simulators or archive, devices work

应用程序不会 运行 在 IOS 模拟器或构建存档上,但 运行 在设备上。 它曾经 运行 很好,突然(无法确定当前可能导致此问题的不同之处)在 android 上发生了类似的问题,文件名太长错误在多次抖动清理后,删除了所有缓存它在真实设备上运行然后再次在模拟器上运行,但不适用于 IOS。

错误信息

/Users/yassin/Library/Developer/Xcode/DerivedData/Runner-dnjtfjbcotehrpgzrmybaaeugzpl/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app: File name too long Command CodeSign failed with a nonzero exit code

Unhandled error domain NSPOSIXErrorDomain, code 63

有关模拟器从 xcode 中 运行ning 时出现的错误的更多详细信息:

Failure Reason: Unhandled error domain NSPOSIXErrorDomain, code 63 User Info: { FunctionName = IXCopyItemAtURL; IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher; SourceFileLine = 121; }

我注意到的一个奇怪的行为是飞镖分析需要很长时间才能启动,当 运行在设备上运行时它会在正常时间构建但安装时间很长(4 分钟以上)在 Macbook M1 上,在 android 和 ios 上都是不寻常的。

扑博士

[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.61.0)

我尝试过的事情:

  1. Flutter clean + Flutter pub get
  2. 正在删除 xcodes 派生数据文件夹 + 重新启动笔记本电脑和 xcode
  3. flutter pub 缓存修复
  4. Pod 安装、更新
  5. 吊销所有证书,安装新证书
  6. 正在关闭自动签名,正在下载配置文件
  7. 锁定和解锁钥匙串登录访问。

Flutter 运行 -- 详细的错误日志:

An error was encountered processing the command
(domain=NSPOSIXErrorDomain, code=63):
                    copyfile of
                    file:///Users/yassin/Desktop/Projects/handles/build/ios/ipho
                    nesimulator/Runner.app/ to
                    file:///Users/yassin/Library/Developer/CoreSimulator/Devices
                    /B864AB8C-79BE-4A09-9351-DDCA31E8C22F/data/Containers/Shared
                    /SystemGroup/systemgroup.com.apple.installcoordinationd/Libr
                    ary/InstallCoordination/PromiseStaging/C21EB07A-E655-4BBA-8B
                    07-5DA8B5397AE4/Runner.app failed: File name too long
                    Unhandled error domain NSPOSIXErrorDomain, code 63
[  +15 ms] Unable to install

/Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.app on
           B864AB8C-79BE-4A09-9351-DDCA31E8C22F. This is sometimes caused by a
malformed
           plist file:
           ProcessException: Process exited abnormally:
           An error was encountered processing the command
(domain=NSPOSIXErrorDomain,
           code=63):
           copyfile of

file:///Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.a
           pp/ to

file:///Users/yassin/Library/Developer/CoreSimulator/Devices/B864AB8C-79BE-4A09-

9351-DDCA31E8C22F/data/Containers/Shared/SystemGroup/systemgroup.com.apple.insta

llcoordinationd/Library/InstallCoordination/PromiseStaging/C21EB07A-E655-4BBA-8B
           07-5DA8B5397AE4/Runner.app failed: File name too long
           Unhandled error domain NSPOSIXErrorDomain, code 63
             Command: /usr/bin/arch -arm64e xcrun simctl install
             B864AB8C-79BE-4A09-9351-DDCA31E8C22F

/Users/yassin/Desktop/Projects/handles/build/ios/iphonesimulator/Runner.app
[   +7 ms] Error launching application on iPhone 12.
[  +10 ms] "flutter run" took 445,079ms.
[  +14 ms] 
           #0      throwToolExit
(package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand
           (package:flutter_tools/src/commands/run.dart:669:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand
(package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand
           (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure>
           (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:92:3)
           <asynchronous suspension>?

很多天后对我有用的是 删除项目文件夹中的所有隐藏文件 除了 git 相关文件,.idea,.packages 等。还有作为 podspec.lock 和 手动构建文件夹

对遇到同样问题的其他人有用的是“删除 flutter 安装文件夹,然后再次从存储库中获取”

这两种选择应该都能解决您的问题。