简体   繁体   English

在 MacOS 上的 iOS 模拟器上运行颤振应用程序失败

[英]Failed run flutter app on iOS Simulator on MacOS

I'm a beginner in flutter , I'm using android studio to create my flutter app and I need some plugins in pubspec.yaml file!我是flutter的初学者,我正在使用android studio创建我的flutter应用程序,我需要pubspec.yaml文件中的一些插件!

The is running without problem, But when I added cloud_firestore, firebase_auth, firebase_storage , ImagePicker and fluttertoast I get an error !运行没有问题,但是当我添加 cloud_firestore、firebase_auth、firebase_storage、ImagePicker 和 fluttertoast 时出现错误!

This is the error:这是错误:

** BUILD FAILED **


Xcode's output:
↳

/Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.4+2/darwin/Classes/FLTFirebaseCorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found
#import "UserAgent.h"
        ^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning build
note: Constructing build description

warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.(in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: There are no architectures to compile for because the VALID_ARCHS build setting is an empty list. (in target 'Runner' from project 'Runner')
In file included from /Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-3.1.3/ios/Classes/UIView+Toast.m:26:
/Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.2.1/ios/Classes/SqflitePlugin.m:2:9: warning: non-portable path to file '<fmdb/FMDB.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import <FMDB/FMDB.h>

my pubspec.yaml file:我的 pubspec.yaml 文件:

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_auth: ^0.12.0
  cloud_firestore: ^0.12.0
  firebase_storage: ^3.1.0
  shared_preferences: ^0.5.4+6
  flutter_offline: ^0.3.0
  provider: ^3.1.0
  simple_animations: ^1.1.3
  page_transition: ^1.1.4
  cupertino_icons: ^0.1.3
  gradient_app_bar: ^0.0.1
  fluttertoast: ^3.1.1
  flutter_spinkit: ^4.0.0
  flutter_launcher_icons: ^0.7.3
  rflutter_alert: ^1.0.3
  url_launcher: ^4.1.0
  flutter_speed_dial: ^1.2.5
  image_picker: ^0.6.3+1
  file_picker: ^1.4.3+2
  validators: ^2.0.0+1
  dio: ^3.0.8
  flutter_plugin_pdf_viewer: ^1.0.7

Can anyone help me and update the plugins versions to compatible versions!谁能帮助我并将插件版本更新为兼容版本!

I found this github issue 2084 and it seems like many people are experiencing the same.One of the qouted solution is rolling back to older verisons of firebase dependencies .dont forget to remove the ^ before the version -- because you don't want to accept the newer version;我发现了这个github 问题 2084 ,似乎很多人都遇到了同样的问题。引用的解决方案之一是回滚到旧版本的 firebase 依赖项。不要忘记删除版本之前的^ - 因为你不想接受较新的版本; and you may need to flutter clean too before building.在构建之前,您可能还需要flutter clean

I have recently faced this type of issue in my projects but no solution works我最近在我的项目中遇到过此类问题,但没有解决方案有效

Try the above setting and then after it will work试试上面的设置,然后就可以了

Go to Xcode -> Select Project -> Build Settings -> Find "Excluded Architectures" -> Add "Any iOS Simulator SDK" -> and give value arm64 for debug only转到 Xcode -> 选择项目 -> 构建设置 -> 查找“Excluded Architectures” -> 添加“Any iOS Simulator SDK” -> 并将值arm64仅用于debug

Clear Derived data + clean build folder and run the app清除派生数据 + 清理构建文件夹并运行应用程序

Please find snap for more clarification请查找 snap 以获得更多说明

在此处输入图像描述

Same thing happened to me:同样的事情发生在我身上:

flutter clean

flutter build ios

( pod install ) If Needed ( pod install ) 如果需要

Xcode's output: ↳ Xcode 的输出:↳

/Users/pictuscode/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.4+2/darwin/Classes/FLTFirebaseCorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found /Users/pictuscode/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.4+2/darwin/Classes/FLTFirebaseCorePlugin.m:6:9:致命错误:'UserAgent.h'文件不是成立

I resolved the error by removing the ^ .我通过删除^解决了错误。

Replacing firebase_core: ^0.4.4+2替换firebase_core: ^0.4.4+2

with firebase_core: 0.4.4 worked使用firebase_core: 0.4.4工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM