Flutter项目未在iOS上运行(尝试2) [英] Flutter project not running on iOS (attempt 2)

查看:108
本文介绍了Flutter项目未在iOS上运行(尝试2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

整理此问题,因为有许多不同的信息并正在取得进展.最初,问题是:

Tidying up this question as there is a lot of different information and progress being made. Originally, the issue was:

flutter run -v

"/Users/sjr/Library/Developer/Xcode/iOS DeviceSupport/13.3.1
(17D50)/Symbols/Developer"
[  +35 ms] (lldb)     command script import
"/tmp/1D186BA70/fruitstrap_4c604fe43a334525340e269626a.py"
[   +4 ms] (lldb)     command script add -f
fruitstrap_4c604fe43a334525340e269626a.connect_command connect
[        ] (lldb)     command script add -s asynchronous -f
fruitstrap_4c604fe43a334525340e269626a.run_command run
[        ] (lldb)     command script add -s asynchronous -f
fruitstrap_4c604fe43a334525340e269626a.autoexit_command autoexit
[        ] (lldb)     command script add -s asynchronous -f
fruitstrap_4c604fe43a334525340e269626a.safequit_command safequit
[        ] (lldb)     connect
[  +52 ms] (lldb)     run
[ +277 ms] success
[        ] (lldb)     safequit
[ +120 ms] Process 434 detached
[  +48 ms] Application launched on the device. Waiting for observatory port.
[   +4 ms] Checking for advertised Dart observatories...
[+5026 ms] mDNS lookup failed, attempting fallback to reading device log.
[        ] Waiting for observatory port.

同时,在XCode中:

And at the same time, in XCode:

io.flutter.204.ui (625): signal SIGABRT

Failed to find snapshot: /private/var/containers/Bundle/Application/E00E6D3690/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin

数百次直到:

../../third_party/dart/runtime/vm/clustered_snapshot.cc: 68: error: Out of memory.

从那时起,我遵循了很多建议,并尝试了不同的尝试和建议来使此工作正常进行,但是到目前为止,没有任何改变.

Since then I have followed a lot of advice and different attempts and suggestions for getting this working, but nothing has made any difference so far.

更新:

昨晚,我在flutter论坛中发现一个线程,提示这都是iOS 13.3引起的,而13.4.1解决了这些问题.将此安装在我的设备上,但对这个问题没有任何影响.

Last night I found a thread in the flutter forums that suggested this was all caused by iOS 13.3, and that 13.4.1 resolves these issues. Installed this on my device but it made no difference at all to this issue.

然后我研究了错误中的路径:

I then investigated the path in the error:

/private/var/containers/Bundle/Application/E00E6D3690/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin

并发现在我的private/var文件夹中,我根本没有名为容器的文件夹,因此当然无法找到它.我不确定该文件夹应该在什么时候填充文件和数据,但这也许是整个混乱的关键.

And found that in my private/var folder I have no folder called containers at all, so of course it's not going to be able to find it. I am not sure at what point this folder is supposed to become populated with files and data, but perhaps this is the key to the whole mess.

有人知道导致这些文件夹填充的原因吗,为什么我的文件夹可能根本不存在?

Does anyone know what causes these folders to populate, and why mine might not exist at all?

推荐答案

超级烦人,是的!

对我有帮助的是:

  1. 在flutter主目录中运行以下命令:

rm -rf ~/Library/Developer/Xcode/DerivedData/rm -rf ~/Library/Caches/CocoaPods/
rm -rf ios/Pods/
pod cache clean --all

# clear flutter - skip the next 3 lines if you're not using flutter
flutter clean
flutter pub get
cd ios

# run pod install
rm Podfile.lock
pod install --repo-update

  1. 重新启动Mac(严重.就像在Windows XP Times中一样).
  2. 如果您使用Firebase,请确保您的AppDelegate.swift具有正确的顺序.
  1. Restart you Mac (Seriously. Like in Windows XP Times).
  2. If you use Firebase, make sure that your AppDelegate.swift has the correct order.

import UIKit
import Flutter
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure()   // <- This line first
    GeneratedPluginRegistrant.register(with: self) // <- This line second
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

(来源: https://github.com/FirebaseExtended/flutterfire/issues/3447#issuecomment-691654019 )

这篇关于Flutter项目未在iOS上运行(尝试2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆