Flutter iOS 不使用 pod
Posted
技术标签:
【中文标题】Flutter iOS 不使用 pod【英文标题】:Flutter iOS not using pods 【发布时间】:2018-11-15 02:38:14 【问题描述】:我当然对编程和颤振相当陌生。我正在尝试使用 firebase pod 来验证我的应用程序中的用户。 android 及其“pubspec”就像一个魅力,但我无法让 ios pod 工作。每当我尝试使用其中一个已安装的 pod 时,我都会收到以下错误,例如:
MissingPluginException(在通道 plugins.flutter.io/firebase_auth 上找不到方法 signInWithEmailAndPassword 的实现)
The 'podfile' and the 'podfile.lock' look like this:
# 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'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) |line|
next if skip_line_start_symbols.any? |symbol| line =~ /^\s*#
symbol/
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#path", file_abs_path)
pods_ary.push(:name => podname, :path => podpath);
else
puts "Invalid plugin specification: #line"
end
return pods_ary
end
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having
Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings =
parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install
manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink,
File.basename(p[:path]))
end
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
PODS:
- BoringSSL (10.0.3):
- BoringSSL/Implementation (= 10.0.3)
- BoringSSL/Interface (= 10.0.3)
- BoringSSL/Implementation (10.0.3):
- BoringSSL/Interface (= 10.0.3)
- BoringSSL/Interface (10.0.3)
- cloud_firestore (0.0.1):
- Firebase/Auth
- Firebase/Core
- Firebase/Database
- Firebase/Firestore
- Flutter
- Firebase/Auth (5.1.0):
- Firebase/CoreOnly
- FirebaseAuth (= 5.0.0)
- Firebase/Core (5.1.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 5.0.1)
- Firebase/CoreOnly (5.1.0):
- FirebaseCore (= 5.0.2)
- Firebase/Database (5.1.0):
- Firebase/CoreOnly
- FirebaseDatabase (= 5.0.1)
- Firebase/Firestore (5.1.0):
- Firebase/CoreOnly
- FirebaseFirestore (= 0.12.2)
- firebase_auth (0.0.1):
- Firebase/Auth
- Firebase/Core
- Flutter
- firebase_core (0.0.1):
- Firebase/Core
- Flutter
- firebase_database (0.0.1):
- Firebase/Database
- Flutter
- FirebaseAnalytics (5.0.1):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- nanopb (~> 0.3)
- FirebaseAuth (5.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseCore (5.0.2):
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- FirebaseDatabase (5.0.1):
- FirebaseCore (~> 5.0)
- leveldb-library (~> 1.18)
- FirebaseFirestore (0.12.2):
- FirebaseCore (~> 5.0)
- FirebaseFirestore/abseil-cpp (= 0.12.2)
- gRPC-ProtoRPC (~> 1.0)
- leveldb-library (~> 1.18)
- Protobuf (~> 3.1)
- FirebaseFirestore/abseil-cpp (0.12.2):
- FirebaseCore (~> 5.0)
- gRPC-ProtoRPC (~> 1.0)
- leveldb-library (~> 1.18)
- Protobuf (~> 3.1)
- FirebaseInstanceID (3.0.0):
- FirebaseCore (~> 5.0)
- Flutter (1.0.0)
- GoogleToolboxForMac/Defines (2.1.4)
- "GoogleToolboxForMac/NSData+zlib (2.1.4)":
- GoogleToolboxForMac/Defines (= 2.1.4)
- gRPC (1.12.0):
- gRPC-RxLibrary (= 1.12.0)
- gRPC/Main (= 1.12.0)
- gRPC-Core (1.12.0):
- gRPC-Core/Implementation (= 1.12.0)
- gRPC-Core/Interface (= 1.12.0)
- gRPC-Core/Implementation (1.12.0):
- BoringSSL (~> 10.0)
- gRPC-Core/Interface (= 1.12.0)
- nanopb (~> 0.3)
- gRPC-Core/Interface (1.12.0)
- gRPC-ProtoRPC (1.12.0):
- gRPC (= 1.12.0)
- gRPC-RxLibrary (= 1.12.0)
- Protobuf (~> 3.0)
- gRPC-RxLibrary (1.12.0)
- gRPC/Main (1.12.0):
- gRPC-Core (= 1.12.0)
- gRPC-RxLibrary (= 1.12.0)
- GTMSessionFetcher/Core (1.1.15)
- leveldb-library (1.20)
- nanopb (0.3.8):
- nanopb/decode (= 0.3.8)
- nanopb/encode (= 0.3.8)
- nanopb/decode (0.3.8)
- nanopb/encode (0.3.8)
- Protobuf (3.5.0)
- url_launcher (0.0.1):
- Flutter
DEPENDENCIES:
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_database (from `.symlinks/plugins/firebase_database/ios`)
- Flutter (from `.symlinks/flutter/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- BoringSSL
- Firebase
- FirebaseAnalytics
- FirebaseAuth
- FirebaseCore
- FirebaseDatabase
- FirebaseFirestore
- FirebaseInstanceID
- GoogleToolboxForMac
- gRPC
- gRPC-Core
- gRPC-ProtoRPC
- gRPC-RxLibrary
- GTMSessionFetcher
- leveldb-library
- nanopb
- Protobuf
EXTERNAL SOURCES:
cloud_firestore:
:path: ".symlinks/plugins/cloud_firestore/ios"
firebase_auth:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_database:
:path: ".symlinks/plugins/firebase_database/ios"
Flutter:
:path: ".symlinks/flutter/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
SPEC CHECKSUMS:
BoringSSL: c46efb47593135382bc0934196f16d2f726f5f36
cloud_firestore: a2d49d9c7219fce31033eb1a2ee953d7733c91d6
Firebase: e08fb0795f35707aeb1d8a715c731c45bdf6fd56
firebase_auth: 27a5a77a032d557c18f8e223aaf8ec1368f6cdbc
firebase_core: c96aa8b2fcf7f5167d32f22034f502f9304952b8
firebase_database: dd62ab9f71967c9011ce2fd03a89e762dcc364df
FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2
FirebaseAuth: acbeef02fe7c3a26624e309849f3fe30c84115af
FirebaseCore: b81044df1044c0857a0737c6324678b72d4f7f00
FirebaseDatabase: 482bad9c2abd422bb2321194fb8c937e67426a89
FirebaseFirestore: 93b8bf70484c92c271ae93940fe1e2ca9e35f92b
FirebaseInstanceID: 83e0040351565df711a5db3d8ebe5ea21aca998a
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f
gRPC: 9362451032695e2dfb7bafcd3740e3a27939e4ff
gRPC-Core: 9696b220565b283e021cf2722d473a4a74b7622a
gRPC-ProtoRPC: a1bd56fb1991a8dae4581250d7259eddabb66779
gRPC-RxLibrary: 1ed5314e8b38cd6e55c9bfa048387136ae925ce9
GTMSessionFetcher: 5fa5b80fd20e439ef5f545fb2cb3ca6c6714caa2
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03
url_launcher: 92b89c1029a0373879933c21642958c874539095
PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2
COCOAPODS: 1.5.3
Flutter Doctor: [✓] Flutter (Channel beta, v0.4.4, on Mac OS X 10.13.4 17E199,语言环境 de-DE) • Flutter 0.4.4 版,位于 /Users/jonasscholz/Entwicklung/flutter • 框架修订f9bb4289e9(3周前),2018-05-11 21:44:54 -0700 • 引擎版本 06afdfe54e • Dart 版本 2.0.0-dev.54.0.flutter-46ab040e58
[!] Android 工具链 - 为 Android 设备开发(Android SDK 27.0.3) • Android SDK 位于 /Users/jonasscholz/Library/Android/sdk • Android NDK 位置未配置(可选;对原生分析支持有用) • 平台 android-27,构建工具 27.0.3 • Java 二进制文件位于:/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java 版 OpenJDK 运行时环境(内部版本 1.8.0_152-release-1024-b01) !不接受某些 Android 许可证。要解决此问题,请运行:flutter doctor --android-licenses
[✓] iOS 工具链 - 为 iOS 设备开发 (Xcode 9.4) • Xcode 位于 /Applications/Xcode.app/Contents/Developer • Xcode 9.4,内部版本 9F1027a • ios 部署 1.9.2 • CocoaPods 1.5.3 版
[✓] Android Studio(版本 3.1) • Android Studio 位于 /Applications/Android Studio.app/Contents • Flutter 插件版本 25.0.1 • Dart 插件版本 173.4700 • Java 版 OpenJDK 运行时环境(内部版本 1.8.0_152-release-1024-b01)
[✓] 连接的设备(2 个可用) • 为 x86 构建的 Android SDK • emulator-5554 • android-x86 • Android 7.1.1 (API 25)(模拟器) • 乔纳斯 iPhone • 56aec322364a426af796f324c15095dd3df68883 • ios • iOS 11.3
!医生发现了 1 个类别的问题。
如果有人在这里帮助我,我会非常高兴!
【问题讨论】:
你的pubspec.yaml
怎么样了?
dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.0 firebase_database: ^0.4.1 firebase_core: any firebase: ^4.3.0 cloud_firestore: ^0.7.1 firebase_auth: ^0.5.10 date_format: ^1.0.4 qr_flutter: ^1.1.1 url_launcher: ^3.0.2 dev_dependencies: flutter_test: sdk: flutter
@hunghd
你解决了吗?
很遗憾没有@Slim_user71169
【参考方案1】:
首先尝试 flutter 包获取 然后在 pods 文件夹中打开终端。
执行命令 pod install 或 pod update
然后打开 xcodeproject 文件和 clean 项目,然后 build
【讨论】:
【参考方案2】:你有没有: 1. 在您的 pubspec.yaml 中包含对 firebase auth 的依赖,并尝试“flutter packages get”和“flutter packages upgrade” 2.更新你的xcode并安装可选工具
【讨论】:
【参考方案3】:尝试步骤:
打开终端然后cd到项目
flutter clean
flutter pub get
flutter build ios
cd ios
pod install --verbose
pod update
【讨论】:
以上是关于Flutter iOS 不使用 pod的主要内容,如果未能解决你的问题,请参考以下文章
Flutter:不使用AppBar时如何在Android和iOS上更改状态栏文本颜色[重复]
Flutter Ios 上不允许使用资源分叉、Finder 信息或类似的碎屑