
Maybe it should be backward compatible,Something like this?
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
#import <PhotosUI/PHPicker.h>
#endif
Maybe it should be backward compatible,Something like this?
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #import <PhotosUI/PHPicker.h> #endif
For me Is giving the same error
PhotosUI/PHPicker.h' file not found
Completely forgot it there, good catch. Thank you!
Strangely I'm able to build on iOS 13 without an issue. Is this something related to Xcode version?
Would you mind on updating Xcode and see if it's working properly?
As it seems, it's backwards compatible by default as long as you use latest Xcode version (which you'll need to build for iOS 14 anyway).
Strangely I'm able to build on iOS 13 without an issue. Is this something related to Xcode version?
Yep, that is a new api based on iOS 14,Xcode 12 with iOS 14 SDK
@tasselx well, I assume that everyone somehow is going to update their xcode to 12 in order to support iOS 14 and onwards.
I'm not sure if it's worth to make conditional import statements through the code as it will eventually be unnecessary, but if you don't have plans to update, I can add it.
Let me know!
@tasselx well, I assume that everyone somehow is going to update their xcode to 12 in order to support iOS 14 and onwards.
I'm not sure if it's worth to make conditional import statements through the code as it will eventually be unnecessary, but if you don't have plans to update, I can add it.
Let me know!
The app crashes on iOS 14 if it imports high version api headers without compatibility. There are still some compatibility issues with flutter for Xcode 12, so I'm looking forward to your update!
@tasselx this is, if I build for iOS 13 simulator using Xcode 12, it works just fine without complaining about the imports.
Currently I have only Xcode 12 installed. Do you know a way to easily replicate this?
@tasselx this is, if I build for iOS 13 simulator using Xcode 12, it works just fine without complaining about the imports.
Currently I have only Xcode 12 installed. Do you know a way to easily replicate this?
You can put old versions of Xcode in a new directory in the application directory, or you can coexist multiple xcodes by giving them different names.
Also, I don't have enough documentation on how crashing a low version of a system can be caused by importing a high version of an api, but I've learned from past experience that this is how it's used in some mature SDKs.
I don't have the latest Xcode yet, but I'll test the issue with iOS 13 if I have to use Xcode 12, and you can do compatibility tests if you can, or open the issue when I have problems with the upgrade.
So what should we do now if we want to use it in Xcode 11.7.1?
I’ll have to create conditional imports @pkmangukiya. I’ll see if I can get it by today.
Thanks @miguelpruivo I ran into this issue today. I have neither a Mac nor XCode so am using CodeMagic which only supports XCode 11.x at the moment, so using 12 would not even be an option for me.
Added to 2.0.2, could you please give it a try and let me know if it worked? I don't have Xcode 11 so I don't have a way to properly try it, but I believe that it should work by now.
I'll wait for your feedback before closing this.
Thank you!
Hi @miguelpruivo , great work out there. I still encounter this. Would you mind take a look at this?
I use ios 13.6, xcode Version 11.6 (11E708)
Xcode's output:
↳
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.m:302:142:
warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
FLLog(FLLogLevelInfo, @"Dropping frame %zu because failed toCGImageSourceCreateImageAtIndexwith image
source %@", i, _imageSource);
^
self->
In file included from
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.m:10:
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h:78:134: note:
expanded from macro 'FLLog'
#define FLLog(logLevel, format, ...) [FLAnimatedImage logStringFromBlock:^NSString *{ return [NSString stringWithFormat:(format),
## __VA_ARGS__]; } withLevel:(logLevel)]
^
1 warning generated.
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.m:302:142:
warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
FLLog(FLLogLevelInfo, @"Dropping frame %zu because failed toCGImageSourceCreateImageAtIndex` with image
source %@", i, _imageSource);
^
self->
In file included from
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.m:10:
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.h:78:134: note:
expanded from macro 'FLLog'
#define FLLog(logLevel, format, ...) [FLAnimatedImage logStringFromBlock:^NSString *{ return [NSString stringWithFormat:(format),
## __VA_ARGS__]; } withLevel:(logLevel)]
^
1 warning generated.
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGallery.swift:447:11:
warning: 'public' modifier is redundant for instance method declared in a public extension
@objc public func present(photoGallery gallery: DKPhotoGallery, completion: (() -> Swift.Void)? = nil) {
^~~
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKPhotoGallery/DKPhotoGallery/Preview/ImagePreview/DKPhotoImageU
tility.swift:82:17: warning: initialization of immutable value 'sourceTotalMB' was never used; consider replacing with assignment
to '_' or removing it
let sourceTotalMB = sourceTotalPixels / Constant.pixelsPerMB
~~~~^~~~~~~~~~~~~
_
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGallery.swift:447:11:
warning: 'public' modifier is redundant for instance method declared in a public extension
@objc public func present(photoGallery gallery: DKPhotoGallery, completion: (() -> Swift.Void)? = nil) {
^~~~~~~
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKPhotoGallery/DKPhotoGallery/Preview/ImagePreview/DKPhotoImageU
tility.swift:82:17: warning: initialization of immutable value 'sourceTotalMB' was never used; consider replacing with assignment
to '_' or removing it
let sourceTotalMB = sourceTotalPixels / Constant.pixelsPerMB
~~~~^~~~~~~~~~~~~
_
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageA
ssetExporter.swift:175:17: warning: variable 'success' was written to, but never read
var success = true
^
/Users/ricardosawir/Documents/Works/peoplebond/pb_connect/ios/Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageA
ssetExporter.swift:175:17: warning: variable 'success' was written to, but never read
var success = true
^
In file included from
/Users/ricardosawir/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.2/ios/Classes/FilePickerPlugin.m:1:
/Users/ricardosawir/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.2/ios/Classes/FilePickerPlugin.h:8:9:
fatal error: 'PhotosUI/PHPicker.h' file not found
#import <PhotosUI/PHPicker.h>
^~~~~~~~~~~~~~~~~~~~~
/Users/ricardosawir/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-2.0.2/ios/Classes/FilePickerPlugin.h:8:9:
note: did not find header 'PHPicker.h' in framework 'PhotosUI' (loaded from
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.6.sdk/System/Library/Frameworks')
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: AssetsLibrary is deprecated. Consider migrating to Photos instead. (in target 'DKPhotoGallery' from project 'Pods')
warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'DKPhotoGallery' from project 'Pods')
warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'FLAnimatedImage' from project 'Pods')
Encountered error while building for device.`
Added to 2.0.2, could you please give it a try and let me know if it worked? I don't have Xcode 11 so I don't have a way to properly try it, but I believe that it should work by now.
I'll wait for your feedback before closing this.
Thank you!
xcode Version 11.5 (11E608c)
file_picker: ^2.0.2
Error message:'PhotosUI/PHPicker.h' file not found
Hi, this is hard for me to fix as I don’t have Xcode 11.5 and everything builds as it should. It’s a bit of trial and error.
@chentianxin you shouldn’t get that as those headers are being conditionally imported to iOS 14 or above. Could you please do a flutter clean, remove Pods and Podfile.lock and then pod install again on your iOS directory?
Thanks!
I'm using CodeMagic, Xcode 11.7.1 (SDK 13.7) and latest CocoaPods. It's a new build machine every time, so nothing stale or lingering. I still receive the error.
While building module 'file_picker' imported from
...
iphoneos/file_picker/file_picker.framework/Headers/FilePickerPlugin.h:8:9: note: did not find header 'PHPicker.h' in framework 'PhotosUI' (loaded from
'/Applications/Xcode-11.7.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk/System/Library/Frameworks')
1 error generated.
/Users/builder/clone/app/xxx/ios/Runner/GeneratedPluginRegistrant.m:20:9: fatal error: could not build module 'file_picker'
#import <file_picker/FilePickerPlugin.h>
~~~~~~~^
** BUILD FAILED **
@paynekw I’ll setup a Xcode 11 environment to fix this.
I’ll get back to you in a few hours.
when i update xcode from 11.7.x to 12.x ,It works!
@zplblue yes. This error happens only because Xcode 11 doesn’t have that framework that was introduced for iOS 14 with Xcode 12. Like I’ve mentioned before, I assume that everyone will eventually overpass this error unless they don’t ever plan to build for iOS 14.
Anyway, right now, this is just a temporary fix for those that want to stick with Xcode 11.
Well... I remember now, for all of you that want to stick with Xcode 11, you can just simply use version 2.0.0 of plugin, as it doesn’t use that framework and you won’t be losing nothing.
Succeeded using package version 2.0.0, thanks @miguelpruivo.
Hi, mine succeeded with using 1.9.0
@sawirricardo it should succeed with 2.0.0 as well, but you must make sure it's using 2.0.0 and not 2.0.1. If you have file_picker: ^2.0.0 it will eventually pick 2.0.1. You must remove the ^.
I've confirmed it worked. Thanks @miguelpruivo . Really appreciate your work here. 👍🏻
By the way @miguelpruivo , i noticed that this block code,
FilePickerResult result = await FilePicker.platform.pickFiles(allowMultiple: true);
if(result != null) {
List<File> files = result.paths.map((path) => File(path));
}
the result will not turn into a list.
List
Thank you @sawirricardo that’s correct. I’ll update accordingly.
Good news to all, I created a Xcode 13 environment where I was able to reproduce the issue and fix the conditional imports. 🎉
You should be able to now run on both Xcode 11 and 12 without an issue, using latest plugin version: 2.0.2+2
Eventually, in the future, the conditional imports won't be required, as I suspect that everyone will have Xcode 12 or above. But as of now, it might be worth it, at least to prevent incoming issues reporting the same and blocking devs from using latest versions which might include other updates.
Please, let me know if it works so I can close this issue.
Good news to all, I created a Xcode 13 environment where I was able to reproduce the issue and fix the conditional imports. 🎉
You should be able to now run on both Xcode 11 and 12 without an issue, using latest plugin version: 2.0.2+2
Eventually, in the future, the conditional imports won't be required, as I suspect that everyone will have Xcode 12 or above. But as of now, it might be worth it, at least to prevent incoming issues reporting the same and blocking devs from using latest versions which might include other updates.
Please, let me know if it works so I can close this issue.
Nothing outstanding from my side, thank you.
Good news to all, I created a Xcode 13 environment where I was able to reproduce the issue and fix the conditional imports. 🎉
You should be able to now run on both Xcode 11 and 12 without an issue, using latest plugin version: 2.0.2+2
Eventually, in the future, the conditional imports won't be required, as I suspect that everyone will have Xcode 12 or above. But as of now, it might be worth it, at least to prevent incoming issues reporting the same and blocking devs from using latest versions which might include other updates.
Please, let me know if it works so I can close this issue.
Thank you @miguelpruivo , I'll give it a try
Good news to all, I created a Xcode 13 environment where I was able to reproduce the issue and fix the conditional imports. 🎉
You should be able to now run on both Xcode 11 and 12 without an issue, using latest plugin version: 2.0.2+2
Eventually, in the future, the conditional imports won't be required, as I suspect that everyone will have Xcode 12 or above. But as of now, it might be worth it, at least to prevent incoming issues reporting the same and blocking devs from using latest versions which might include other updates.
Please, let me know if it works so I can close this issue.
I've confirmed that it has been fixed. Thank you @miguelpruivo 👍🏻
Thank you very much for your work
2.0.2+2
Yeah, it's done. now it's fixed and work as well in Xcode Version 11.3.1. thanks @miguelpruivo for give your precious time 🎉
Most helpful comment
I've confirmed that it has been fixed. Thank you @miguelpruivo 👍🏻