gpt4 book ai didi

ios - 在将 Firebase 云消息传递依赖项添加到 PubSpec.yaml -Flutter 时构建应用程序失败

转载 作者:行者123 更新时间:2023-12-04 03:36:41 43 4
gpt4 key购买 nike

当我使用 VScode 或终端或 XCode 构建应用程序时,它在不添加依赖项的情况下运行完美,但是当我将依赖项添加到我的 Pubspec.yaml 时,我收到以下错误:


/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/GDTCCTUploadOperation.m:36:9: fatal error: 'GoogleUtilities/GULURLSessionDataResponse.h' file not found
#import <GoogleUtilities/GULURLSessionDataResponse.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11.
Exited (sigterm)**

**

我尝试在此处搜索解决方案,但找不到任何解决方案。我尝试过的以前的解决方案是:

  1. 先运行 Flutter Clean,然后运行 ​​Flutter Run(无效)
  2. 删除 Podfile.lock 和 podfile 以及 .xcworkspace 文件,然后在终端中运行 pod install(没有用)
  3. 广告连播更新

这是我的 flutter 医生 Trace:

**[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2 20D64 darwin-x64, locale en-EG)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Connected device (2 available)**

这是我的 PodFile:


# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

这是我的 pubspec.yaml,是的,我使用的是旧版本的 firebase 云消息传递,这是由于 firebase Core 和新的 Firebase 云消息传递版本“^9.0.0”之间的依赖冲突


version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
firebase_core: "0.7.0"
firebase_auth: ^0.20.0+1
flutter_spinkit: "^4.1.2"
google_sign_in: ^4.5.3
connectivity: ^2.0.2
path: any
sqflite: ^1.3.2+3
share: ^0.6.5+4
flutter_facebook_login: ^3.0.0
apple_sign_in: ^0.1.0
provider: ^4.0.1
crypto: ^2.1.5
in_app_purchase: ^0.5.1
flutter_email_sender: ^5.0.0
scroll_snap_list: ^0.6.0
firebase_messaging: ^5.1.2
flutter_twitter_login:
git: https://github.com/Kiruel/flutter_twitter_login
cupertino_icons: ^1.0.0

dev_dependencies:
flutter_test:
sdk: flutter

最佳答案

我终于想出了解决办法。解决方案是在 firebase 中创建 iOS App 时不遵循 firebase.google.com 上的指南。您应该严格遵守 https://firebase.flutter.dev/docs/overview/ 上的指南

回顾一下我采取的步骤:

  1. 创建了一个新的 flutter 项目
  2. 在 pubspec.yaml 中添加了 firebase_core: "0.7.0"under dependencies。酒吧得到了吗
  3. 浏览到项目目录 > iOS 文件夹 > 打开 projectname.xcworkspace
  4. 点击 Runner 并在 General 中复制 Bundle Identifier。
  5. 在“常规”选项卡的“开发信息”中将 iOS 版本更改为 10 或更高版本
  6. 将这个 Bundle Identifier 粘贴到“Add Firebase to your iOS app” Step 1 Register
  7. 点击下一步并下载 GoogleService-Info.plist
  8. 在 projectname.xcworkspace 中点击顶部的 Runner。右键单击并按“将文件添加到 Runner”。浏览 GoogleService-Info.plist 文件。确保启用“需要时复制项目”复选框
  9. 完成后运行该项目,无需采取任何进一步的步骤,它应该可以正常工作。

我刚刚创建了两个新项目以确保它在发布到这里之前可以正常工作并且工作正常。我希望它也对你有用。

关于ios - 在将 Firebase 云消息传递依赖项添加到 PubSpec.yaml -Flutter 时构建应用程序失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66769368/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com