【问题标题】:Error Launching Flutter App on iOS Simulator, App Crashes在 iOS 模拟器上启动 Flutter 应用程序时出错,应用程序崩溃
【发布时间】:2021-05-21 03:52:06
【问题描述】:

我在 iOS 模拟器上启动 Flutter 应用时遇到问题。这个问题似乎与 localhost 连接或 Firebase 有关,我无法判断。从下面的错误来看,但我无法找到解决方法。

我正在运行 MacOS BigSur。

应用程序在 Android 模拟器上启动并运行良好。

以下是 Android Studio 终端的错误输出:

Running pod install...
Running Xcode build...
Xcode build done.                                           716.3s
Configuring the default Firebase app...
Configured the default Firebase app __FIRAPP_DEFAULT.
Connecting to the VM Service is taking longer than expected...
Still attempting to connect to the VM Service...
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode) might have more details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a specific port known to be available.
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 57172
This was attempt #50. Will retry in 0:00:01.600000.
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 57265
This was attempt #100. Will retry in 0:00:01.600000.
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 57356
This was attempt #150. Will retry in 0:00:01.600000.
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 57454
This was attempt #200. Will retry in 0:00:01.600000.
Exception attempting to connect to the VM Service: SocketException: OS Error: Connection refused, errno = 61, address = 127.0.0.1, port = 57586
This was attempt #250. Will retry in 0:00:01.600000.

我尝试使用一些在线解决方案来解决这个问题,例如:Errors Launching Flutter app in iOS Simualtor

但这只是从堆栈跟踪(Android Studio 终端)中删除了错误,并且应用程序仍然崩溃。

有人可以帮忙吗?谢谢!

【问题讨论】:

  • @JanviPatel 还没有,还在尝试!

标签: android ios swift flutter flutter-test


【解决方案1】:

该错误表明您在应用内使用了firebase但未初始化它尝试按照以下步骤对其进行初始化 在 Appdelegate.swift 文件中添加

  import Firebase //this line
   Bool{
    FirebaseApp.configure()//this line

在 pod 内的 pod 文件中

 target 'Runner' do
   pod 'Firebase/Analytics' //this line

然后尝试重新构建

【讨论】:

  • 它给出了以下错误:错误:CocoaPods 的规范存储库太过时,无法满足依赖关系。要更新 CocoaPods 规格,请运行: pod repo update Error running pod install Error 在 iPhone 12 Pro Max 上启动应用程序。
  • 先安装 cocoa pods 然后运行 ​​pod install
  • 还是不行。应用程序崩溃。我还删除了使用 pod install --repo-update 重新安装的 podfile.lock 但仍然没有运气。应用构建后无错误崩溃!
猜你喜欢
  • 1970-01-01
  • 2020-11-22
  • 2011-10-11
  • 1970-01-01
  • 2019-01-24
  • 2021-01-15
  • 2016-02-15
  • 2022-01-06
相关资源
最近更新 更多