Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter: 'UIAlertView' is deprecated: first deprecated in iOS 9.0

Tags:

ios

flutter

I got the following error:

/Users/flo/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+12/ios/Classes/FLTImagePickerPlugin.m:1
    49:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated.
    Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead
    [-Wdeprecated-declarations]
        [[[UIAlertView alloc] initWithTitle:@"Error"

I already try to do:

flutter pub cache repair

rm the .pub-cache/hosted/pub.dartlang.org directory

rm podfile.lock and Pods folder

But still the same issue. Any ideas ? I only find issues like this for Swift but not related to Flutter.

like image 825
Lab Avatar asked Oct 16 '20 23:10

Lab


1 Answers

I allow myself to answer my question which may benefit others who have the same problem, here is a simple solution that worked for me. You don't have to repair/update the cache or edit the Podfile and remove the Pods folder.

  • Just comment out the package on the Pubspec that generates the error (in that case: image_picker)
  • flutter run (you may have errors due to the missing package, ignore them)
  • Uncomment the line
  • Run again and the error should be gone
like image 57
Lab Avatar answered Nov 11 '22 03:11

Lab