Flutter安装package插件后在IOS模拟器debug模式启动报错的问题?
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A file_picker
- Flutter
- flutter_secure_storage
- image_gallery_saver
- image_picker_ios
- path_provider_foundation
- sqflite
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `file_picker` from `.symlinks/plugins/file_picker/ios`
-> Fetching podspec for `flutter_secure_storage` from `.symlinks/plugins/flutter_secure_storage/ios`
-> Fetching podspec for `image_gallery_saver` from `.symlinks/plugins/image_gallery_saver/ios`
-> Fetching podspec for `image_picker_ios` from `.symlinks/plugins/image_picker_ios/ios`
-> Fetching podspec for `path_provider_foundation` from `.symlinks/plugins/path_provider_foundation/ios`
-> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
Resolving dependencies of `Podfile`
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: all_pods_versions_1_6_1.txt exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/4.3.4/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/1.0.0/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/1.0.2/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/1.0.3/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/1.0.4/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/1.1.0/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/2.0.0/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/2.1.0/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
CDN: trunk Relative path: Specs/1/6/1/DKImagePickerController/2.2.0/DKImagePickerController.podspec.json exists! Returning local because checking is only performed in repo update
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
/usr/local/bin/pod install --verbose
```
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods : 1.12.0
Ruby : ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin21]
RubyGems : 3.1.4
Host : macOS 12.6 (21G115)
Xcode : 14.1 (14B47b)
Git : git version 2.28.0
Ruby lib dir : /Users/shixin/.rvm/rubies/ruby-2.7.2/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ f9601f9e3bc34475658ed856044a328387849f53
trunk - CDN - https://cdn.cocoapods.org/
```
### Plugins
```
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
```
### Podfile
```ruby
# Uncomment this line to define a global platform for your project
platform :ios, '11.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
```
### Error
```
JSON::ParserError - Failed to parse JSON at file: '/Users/shixin/.cocoapods/repos/trunk/Specs/1/1/7/SDWebImage/4.3.2/SDWebImage.podspec.json'.
434: unexpected token at '{
"name": "WebP",
"source_files": [
"SDWebImage/UIImage+WebP.{h,m}",
"SDWebImage/SDWebImageWebPCoder.{h,m}"
],
"xcconfig": {
"GCC_PREPROCESSOR_DEFINITIONS": "$(inherited) SD_WEBP=1",
"USER_HEADER_SEARCH_PATHS": "$(inherited) $(SRCROOT)/libwebp/'
/Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'
/Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/specification.rb:752:in `from_string'
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=Failed+to+parse+JSON+at+file%3A+%27%2FUsers%2Fshixin%2F.cocoapods%2Frepos%2Ftrunk%2FSpecs%2F1%2F1%2F7%2FSDWebImage%2F4.3.2%2FSDWebImage.podspec.json%27.%0A%0A434%3A+unexpected+token+at+%27%7B%0A++++++%22name%22%3A+%22WebP%22%2C%0A++++++%22source_files%22%3A+%5B%0A++++++++%22SDWebImage%2FUIImage%2BWebP.%7Bh%2Cm%7D%22%2C%0A++++++++%22SDWebImage%2FSDWebImageWebPCoder.%7Bh%2Cm%7D%22%0A++++++%5D%2C%0A++++++%22xcconfig%22%3A+%7B%0A++++++++%22GCC_PREPROCESSOR_DEFINITIONS%22%3A+%22%24%28inherited%29+SD_WEBP%3D1%22%2C%0A++++++++%22USER_HEADER_SEARCH_PATHS%22%3A+%22%24%28inherited%29+%24%28SRCROOT%29%2Flibwebp%2F%27&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
Error output from CocoaPods:↳
Searching for inspections failed: undefined method `map' for nil:NilClass
Error running pod installError launching application on iPad Pro (12.9-inch) (5th generation).
回复
1个回答
test
2024-07-06
rm -rf ~/.cocoapods/repos/trunk/
如果还不行删除
rm -rf ~/.cocoapods/repos/Spec_Lock
回复
适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容