Closed doomsdayer closed 5 years ago
@doomsdayer image_downloader have been specified Swift Version Language 4. In addition, I confirmed the operation with a library containing sqflite as well as you. The result worked fine.
I think that your app's PodFile is not going well. How about adding the following in your app's Podfile?
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
Please let me know again if the problem is not resolved.Thank you.
@ko2ic I got same error:
it seems your codes contains swift3x, how to migrate it to 4?
@jinfagang Thanks for your comment.
Is it an error even if I try the following? https://github.com/ko2ic/image_downloader/issues/9#issuecomment-471186536
@ko2ic I haven't try that, I am using the newest xcode 10.2, which may need newest swift version.
@ko2ic So I replaced some code in the ios/Podfile ~~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~~
to
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.0' end end end
but still the same
Launching lib/main.dart on iPhone XR in debug mode... Running pod install... CocoaPods' output: ↳ Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
Finding Podfile changes
A image_downloader
- Flutter
- device_info
- fluttertoast
- package_info
- path_provider
- shared_preferences
- sqflite
Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `device_info` from `.symlinks/plugins/device_info/ios`
-> Fetching podspec for `fluttertoast` from `.symlinks/plugins/fluttertoast/ios`
-> Fetching podspec for `image_downloader` from `.symlinks/plugins/image_downloader/ios`
-> Fetching podspec for `package_info` from `.symlinks/plugins/package_info/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A FMDB
A Flutter
A device_info
A fluttertoast
A image_downloader
A package_info
A path_provider
A shared_preferences
A sqflite
Downloading dependencies
-> Installing FMDB (2.7.5)
> Copying FMDB from `/Users/luyusheng/Library/Caches/CocoaPods/Pods/Release/FMDB/2.7.5-2ce00` to `Pods/FMDB`
-> Installing Flutter (1.0.0)
-> Installing device_info (0.0.1)
-> Installing fluttertoast (0.0.2)
-> Installing image_downloader (0.0.1)
-> Installing package_info (0.0.1)
-> Installing path_provider (0.0.1)
-> Installing shared_preferences (0.0.1)
-> Installing sqflite (0.0.1)
- Running pre install hooks
[!] Unable to determine Swift version for the following pods:
- `image_downloader` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:115:in `verify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:459:in `validate_targets'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:138:in `install!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/install.rb:48:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22: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`.
Error running pod install Error launching application on iPhone XR.
when I run the pod install, I got this
Analyzing dependencies
Fetching podspec for Flutter
from .symlinks/flutter/ios
Fetching podspec for device_info
from .symlinks/plugins/device_info/ios
Fetching podspec for fluttertoast
from .symlinks/plugins/fluttertoast/ios
Fetching podspec for image_downloader
from .symlinks/plugins/image_downloader/ios
Fetching podspec for package_info
from .symlinks/plugins/package_info/ios
Fetching podspec for path_provider
from .symlinks/plugins/path_provider/ios
Fetching podspec for shared_preferences
from .symlinks/plugins/shared_preferences/ios
Fetching podspec for sqflite
from .symlinks/plugins/sqflite/ios
Downloading dependencies
Installing FMDB (2.7.5)
Installing Flutter (1.0.0)
Installing device_info (0.0.1)
Installing fluttertoast (0.0.2)
Installing image_downloader (0.0.1)
Installing package_info (0.0.1)
Installing path_provider (0.0.1)
Installing shared_preferences (0.0.1)
Installing sqflite (0.0.1)
[!] Unable to determine Swift version for the following pods:
image_downloader
does not specify a Swift version and none of the targets (Runner
) integrating it have the SWIFT_VERSION
attribute set. Please contact the author or set the SWIFT_VERSION
attribute in at least one of the targets that integrate this pod.[!] 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
.
@doomsdayer @jinfagang I can not reproduce it, but I fixed it. It may not change, please try v0.11.2.
@ko2ic Thanks, I will try it tonight, the most likely reason for this maybe I am using the newest version xcode
@ko2ic still the same.... I have created a grand new project and only add the dependence image_downloader and got the same error. I have sent the project to you by mail, could it work well at your environment? My XCode is 10.1
@doomsdayer My environment is also Xcode 10.1. It is working. In addition, I use it in multiple projects but it works.
Does it work on the example project?
@doomsdayer My environment is also Xcode 10.1. It is working. In addition, I use it in multiple projects but it works.
Does it work on the example project?
@ko2ic Yes, the example is Ok, and I found there's AppDelegate.swift in your example. But the project I gave you (created by flutter new project wizard) is based on AppDelegate.h and AppDelegate.m, so there must be some issue of incompatible.
Could it be fixed?
@ko2ic I found a solution for this issue, but not perfect.
use_frameworks!
in the PodfileThen the project can run on ios emulator by Android Studio with Flutter plugin, But can't run by XCode, error msg is
could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner')
@doomsdayer Oh, it was that situation. This problem happens with all Swift plugins. https://github.com/flutter/flutter/issues/25676
You are almost right. It seems to work with the following
File -> New -> File -> Swift File
.
A dialog will be displayed when creating the swift file(Since this file is deleted, any name can be used.). XCode will ask you if you wish to create Bridging Header, click yes.use_frameworks!
in the Runner block, in ios/Podfile
。SWIFT_VERSION
4.2 selected in you XCode -> Build Settings
flutter clean
Podfile.lock
and Pods folder and then execute pod install --repo-update
Thank you for giving detailed report!!
@ko2ic Does it will update this package release? I am pretty new in iOS development, it seems not convenient to use compare with other flutter packages
@jinfagang Does it mean to rewrite to objective-c? There is no plan to rewrite it now. Since this is a problem with flutter, there is no problem if the flutter side fix.
In addition, If you select swift when creating the app, it will work without doing anything.
it seems not convenient to use compare with other flutter packages
Plugins created with swift all have the same problem.
@ko2ic OK, now I understand it
@doomsdayer If you have not worked yet, please refer to the following. https://github.com/ko2ic/sample_image_downloder_objc
It is a sample of AppDelegate made with Objective-C.
I'll fix it below so close it.
https://github.com/ko2ic/image_downloader/wiki#your-appdelegate-is-the-case-of-objective-c
If the same problem occurs, please set up another issue.
Launching lib/main.dart on iPhone Xʀ in debug mode... Running pod install... 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 `.symlinks/flutter/ios`
-> Fetching podspec for `camera` from `.symlinks/plugins/camera/ios`
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
-> Fetching podspec for `flutter_text_to_speech` from `.symlinks/plugins/flutter_text_to_speech/ios`
-> Fetching podspec for `flutter_tts` from `.symlinks/plugins/flutter_tts/ios`
-> Fetching podspec for `razorpay` from `.symlinks/plugins/razorpay/ios`
-> Fetching podspec for `tflite` from `.symlinks/plugins/tflite/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A Firebase
A FirebaseAnalytics
A FirebaseCore
A FirebaseInstanceID
A Flutter
A GoogleAppMeasurement
A GoogleUtilities
A TensorFlowLite
A camera
A firebase_core
A flutter_text_to_speech
A flutter_tts
A nanopb
A razorpay
A tflite
Downloading dependencies
-> Installing Firebase (6.3.0)
> Copying Firebase from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/Firebase/6.3.0-8432d` to `Pods/Firebase`
-> Installing FirebaseAnalytics (6.0.2)
> Copying FirebaseAnalytics from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/FirebaseAnalytics/6.0.2-470dd` to `Pods/FirebaseAnalytics`
-> Installing FirebaseCore (6.0.3)
> Copying FirebaseCore from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/FirebaseCore/6.0.3-68f8a` to `Pods/FirebaseCore`
-> Installing FirebaseInstanceID (4.2.0)
> Copying FirebaseInstanceID from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/FirebaseInstanceID/4.2.0-f2024` to `Pods/FirebaseInstanceID`
-> Installing Flutter (1.0.0)
-> Installing GoogleAppMeasurement (6.0.2)
> Copying GoogleAppMeasurement from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/GoogleAppMeasurement/6.0.2-a35a6` to `Pods/GoogleAppMeasurement`
-> Installing GoogleUtilities (6.2.0)
> Copying GoogleUtilities from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/GoogleUtilities/6.2.0-996e0` to `Pods/GoogleUtilities`
-> Installing TensorFlowLite (1.13.1)
> Copying TensorFlowLite from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/TensorFlowLite/1.13.1-8b9dc` to `Pods/TensorFlowLite`
-> Installing camera (0.0.1)
-> Installing firebase_core (0.0.1)
> Running prepare command
$ /bin/bash -c set -e echo // Generated file, do not edit > Classes/UserAgent.h echo "#define LIBRARY_VERSION @\"0.4.0-6\"" >> Classes/UserAgent.h echo "#define LIBRARY_NAME @\"flutter-fire-core\"" >> Classes/UserAgent.h
-> Installing flutter_text_to_speech (2.0.0)
-> Installing flutter_tts (0.0.1)
-> Installing nanopb (0.3.901)
> Copying nanopb from `/Users/macbookrosegold/Library/Caches/CocoaPods/Pods/Release/nanopb/0.3.901-2901f` to `Pods/nanopb`
-> Installing razorpay (0.0.1)
-> Installing tflite (1.0.4)
- Running pre install hooks
[!] Unable to determine Swift version for the following pods:
- `flutter_tts` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
- `razorpay` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/installer/xcode/target_validator.rb:122:in `verify_swift_pods_swift_version'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:578:in `validate_targets'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:158:in `install!'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/command/install.rb:51:in `run'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.7.2/libexec/gems/cocoapods-1.7.2/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.7.2/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.7.2/libexec/bin/pod:22:in `<main>'
Error output from CocoaPods: ↳
[!] Automatically assigning platform `ios` with version `9.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`.
Error running pod install Error launching application on iPhone Xʀ.
The easiest way to solve this problem is to create a new. swift file under the iOS file.
@doomsdayer Oh, it was that situation. This problem happens with all Swift plugins. flutter/flutter#25676
You are almost right. It seems to work with the following
- Bridging Header must be created. Open the project with XCode. Then choose
File -> New -> File -> Swift File
. A dialog will be displayed when creating the swift file(Since this file is deleted, any name can be used.). XCode will ask you if you wish to create Bridging Header, click yes.- Make sure you have
use_frameworks!
in the Runner block, inios/Podfile
。- Make sure you have
SWIFT_VERSION
4.2 selected in youXCode -> Build Settings
- Do
flutter clean
- Go to your ios folder, delete
Podfile.lock
and Pods folder and then executepod install --repo-update
Thank you for giving detailed report!!
As Swift 5 is there for some time. Will there any issue if we have SWIFT_VERSION 5.0 in the Xcode?
Just an update for future googlers, this is what I do to manually set the swift version of legacy CocoaPods libraries:
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
if s.name == 'YOUR_POD_NAME_HERE'
s.swift_version = '4.2'
end
end
end
@redent Where exactly do you put this?
@kasp1 just in your Podfile
, any position is good, so can be at the lower end.
@danydev Thanks, figured it out. For some reason there was no Podfile in my project so I had to put it together.
And then I found these templates... https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/cocoapods
@ko2ic Hello, What if pod install --repo-update running slowly? Can I ignore this command? And if I finished it and my other projects have the same issue should I run it again?
Fix mine by going to ios/Podfile.... then add ENV['SWIFT_VERSION'] = '5' at the top of your podfile.
Update: Also adding this use_frameworks! # required by HexColor below the swift version
Just add a few amazing lines in the plugin amazon_s3_cognito.podspec file
s.swift_version = '5.0'
s.ios.deployment_target = '11.0'
according to your app support
Wanna run on IOS emulator(iphone xr), and I got these:
Launching lib/main.dart on iPhone XR in debug mode... Running pod install... CocoaPods' output: ↳ Preparing
Error output from CocoaPods: ↳
Error running pod install Error launching application on iPhone XR.
seems like image_downloader goes wrong?