我试图在 IOS 模拟器上运行我的 flutter 应用程序,但它不工作。所以尝试了最基本的 flutter 应用程序(创建 my_app 然后尝试运行它)但似乎没有任何效果! 当我从终端运行它直到链接和签名阶段时,一切似乎都工作正常,我在哪里得到错误,我该如何解决?
这是我得到的错误:
Unable to install
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app on
82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15. This is sometimes caused by a malformed
plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command
(domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8B
B9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoord
inationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-BC2E
82D37D17/my_app.app to installd
Underlying error (domain=MIInstallerErrorDomain, code=103):
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8
BB9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoo
rdinationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-B
C2E82D37D17/my_app.app to installd
Command: /usr/bin/xcrun simctl install 82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 11 Pro Max.
编辑: 我更新了我的 MacOS,删除并重新安装了 Xcode,我什至尝试运行最简单的 swift 应用程序,但我总是遇到同样的错误,看起来构建成功但无法安装。我仍然遇到同样的错误,我该怎么办?
这发生在我先打开模拟器然后更新 XCode 时——即使在 XCode 完全更新之前没有运行应用程序。
对我有用的:
flutter clean
如果仍然不起作用,请尝试在模拟器菜单中的“设备”->“清除所有内容和设置...”中重置设备。
几天前我遇到了同样的问题
我所做的 - 以及解决问题的方法 - 是重置模拟器(设备 - >清除所有内容和设置),然后运行
$ flutter clean
您现在应该能够再次运行您的应用
以上都不适合我。我创建了另一个 flutter 应用程序并将其 ios 文件夹复制到我的项目中。像魅力一样工作
节省时间,只需从模拟器中清除设备内容和设置,然后运行 flutter clean。应用程序应该可以正常运行。
flutter clean
,然后再次运行您的应用程序如果缺少 GoogleService-Info.plist,就会发生这种情况。
当您更新 XCode 并且您的模拟器在后台运行时,也会发生这种情况。 关闭模拟器并打开 Xcode,您将获得安装其他工具的选项,安装它们然后运行应用程序。
老实说。这对开发者来说真的很令人沮丧
这就是我修复的方式!
flutter clean
flutter pub get
cd ios
rm Podfile.lock
pod repo update
pod install
cd ..
然后运行应用程序,成功了!
另一种解决方案是从 Xcode 运行一次 Runner.xcworkspace 应用程序,这可能会解决它。
在我的例子中,这是因为在迁移到新的 Firebase (FlutterFire) 初始化后,在
GoogleService-Info.plist
内挂空的 Xcode
文件。
Xcode
不是常规的拖放式 IDE,它直接将项目文件映射到文件系统中的文件。它宁愿缓存文件引用。所以即使你删除了一个.plist
文件,Xcode
仍然保持对它的引用。
只需打开
Xcode
IDE并删除.plist
文件(依次更新project.pbxproj
)。这帮助我很好地编译了项目。
我最近遇到了同样的问题。我发现我通过 xcode 添加了我的 GoogleService-info.plist 文件到子目录 Runner 而不是主项目目录 Runner 。我再次打开 xcode,删除文件并将其重新添加到正确的位置,现在一切正常。