flutter_vant_kit
flutter_vant_kit copied to clipboard
flutter v1.17.0 安装后 iOS 端不能直接工作 【带解决办法】
这个问题很有可能是 flutter 自己的bug,反正不是很友好。
当你把插件添加到 pubspec.yaml
文件,flutter pub get
后,直接运行 iOS 端应该是遇到一些问题。android端能正常运行,只有一段下面这种看着不舒服的提示。
注: /Users/felix/.pub-cache/hosted/pub.flutter-io.cn/multi_image_picker-4.6.7/android/src/main/java/com/vitanov/multiimagepicker/FileDirectory.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
iOS 你应该会看到的日志: 大概这个样子。
Launching lib/main.dart on 郭大鹏的iPhone in debug mode...
Signing iOS app for device deployment using developer identity: "Apple Development: [email protected] (M4243PURVY)"
Running pod install... 1.2s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `multi_image_picker` from `.symlinks/plugins/multi_image_picker/ios`
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "multi_image_picker":
In Podfile:
multi_image_picker (from `.symlinks/plugins/multi_image_picker/ios`)
Specs satisfying the `multi_image_picker (from `.symlinks/plugins/multi_image_picker/ios`)` dependency were found, but they required a higher minimum deployment target.
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Exception: Error running pod install
打开 Xcode ,你应该看到一堆红字。
Showing Recent Issues
/Users/felix/EasyWork/Project/lightEnter/other/qingLive/project/applive_flutter/applive/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths
然后使用终端进入 iOS 项目目录运行 pod install
,会有下面的提示。这时候不要慌张。
$ pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "multi_image_picker":
In Podfile:
multi_image_picker (from `.symlinks/plugins/multi_image_picker/ios`)
Specs satisfying the `multi_image_picker (from `.symlinks/plugins/multi_image_picker/ios`)` dependency were found, but they required a higher minimum deployment target.
[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
修改 iOS 项目目录下面的 Podfile
文件,在 flutter v1.17.0 版本中,貌似这个文件只有在 flutter 插件时才会出现,我记得以前不是这样的。可能是幻觉。我将 platform :ios, '13.0'
这个设置为 iOS13 了,因为我计划使用 switchUI 写部分功能。之后在终端 iOS项目目录执行 pod install
。经过漫长的等待(我这里网络的问题),看到下面提示。
$ pod install
Analyzing dependencies
Downloading dependencies
Installing BSGridCollectionViewLayout (1.2.5)
Installing BSImagePicker (2.10.3)
Installing BSImageView (1.0.3)
Installing Flutter (1.0.0)
Installing multi_image_picker (4.6.7)
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 5 total pods installed.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
这时候 Xcode 会弹出一个提示,意思是 Xcode 项目有一些变化,你需要决定一下,是使用现在打开的覆盖硬盘上的,还是读取硬盘上的丢弃现在打开的,我选择了后者,Xcode Version 11.4.1 (11E503a) 这个版本,是左边的按钮。我忘记截图了。
然后和想的还是不一样,Pods 这个项目看不见,不过没关系,关闭Xcode在打开一次就好了,我是在 Android studio 中右键打开的。
之后就能运行了。