flutter_inappwebview icon indicating copy to clipboard operation
flutter_inappwebview copied to clipboard

Xcode 14 build error: Stored properties cannot be marked potentially unavailable with '@available'

Open SethuSenthil opened this issue 3 years ago • 10 comments

Environment

Technology Version
Flutter version 3.0.1
Plugin version 5.4.3+7
Android version n/a
iOS version 16.0 DB1
Xcode version 14 B1

Device information:

Description

When attempting to compile with the new Xcode beta, the following error prevents us from completin.g the build

Expected behavior: No error

Current behavior: Throws build error: Stored properties cannot be marked potentially unavailable with '@available'

Steps to reproduce

  1. Run flutter run on any project that depends on flutter_inappwebview

Images

Screen Shot 2022-06-08 at 4 01 13 PM

SethuSenthil avatar Jun 08 '22 20:06 SethuSenthil

👋 @SethuSenthil

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

github-actions[bot] avatar Jun 08 '22 20:06 github-actions[bot]

After doing some experimentation, I believe the most straightforward approach would be to wrap the class around another class that will instantiate two different versions of the UserScript class, one specifically meant for iOS 14+ and the other for versions less than iOS 14. This is because we need the ' @available(iOS 14.0, *)' header above the entire class in order to utilize WKContentWorld in this new build process

SethuSenthil avatar Jun 09 '22 06:06 SethuSenthil

@pichillilorenzo is there any work around until the issue get fixed?

ghensto avatar Jun 09 '22 18:06 ghensto

@pichillilorenzo is there any work around until the issue get fixed?

This is not really a workaround but might be helpful to someone, for now, you can just build through Xcode 13 after installing the Xcode 14 beta which comes with iOS 16 device support that is actually compatible with Xcode 13. In other words, you can build (for testing) for iOS 16 targets from Xcode 13 after you install the 14 beta alongside it. However, flutter run does not work so you always need to build through Xcode (you lose hot reloading) which might be a hassle.

SethuSenthil avatar Jun 09 '22 19:06 SethuSenthil

Code Eagle's open PR resolves this issue.

mikhael28 avatar Jul 21 '22 21:07 mikhael28

@mikhael28 Can you share PR link?

note11g avatar Aug 10 '22 08:08 note11g

also exists on the Xcode 14.0 stable version

Temporary solution: https://github.com/pichillilorenzo/flutter_inappwebview/pull/1238#issuecomment-1244976136

cimplesid avatar Sep 13 '22 06:09 cimplesid

I've simply fixed it by updating the platform to iOS 14 in Podfile.

https://stackoverflow.com/a/73699790/9779791

mirkancal avatar Sep 13 '22 08:09 mirkancal

@mirkancal but this means that you only support iOS 14 and higher

I used another git repo wich already has the fix included as workaround

flutter_inappwebview: git: https://github.com/CodeEagle/flutter_inappwebview

riegersan avatar Sep 13 '22 08:09 riegersan

@riegersan yes. 7 years old iPhone 6s has iOS 14. I'm okay with it.

mirkancal avatar Sep 13 '22 08:09 mirkancal

I fix update target 14 in file ios/Podfile config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'

luan20495 avatar Sep 14 '22 07:09 luan20495

dependency_overrides and flutter pub cache repair solved some problems, but android studio still showing the following issues when I try flutter build iOS or flutter run I fixed these issues in Xcode pods page where I chose my apple developer account " Select a development team in the Signing & Capabilities editor". I could build the project and run it. BUT When I tried to build/run my project again I got the following errors again. It seems that the file restart itself.

How to fix it to avoid pods Signing & Capabilities again?

/Users/blue492/flutter/bin/flutter --no-color build ios
Building com.test.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: 432432532
Running pod install...                                              7.6s
Running Xcode build...                                          
Xcode build done.                                           19.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/cc/3b8b8j7s3nd92qwt4_6zgzhh0000gn/T/flutter_tools.FkUIb7/flutter_ios_build_temp_dirCo3hLK/temporary_xcresult_bundle

    note: Building targets in dependency order
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: error: Signing for "TOCropViewController-TOCropViewControllerBundle" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GoogleDataTransport' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'MLKitBarcodeScanning' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'nanopb' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GTMSessionFetcher' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'SwiftyGif' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'Protobuf' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'MLKitCommon' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'ReachabilitySwift' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'MLKitVision' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'TOCropViewController' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GoogleMLKit' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'DKImagePickerController' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'SDWebImage' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'MLImage' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GoogleUtilities' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'DKImagePickerController-DKImagePickerController' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: error: Signing for "DKImagePickerController-DKImagePickerController" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'DKImagePickerController-DKImagePickerController' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'PromisesObjC' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'OrderedSet' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'DKPhotoGallery-DKPhotoGallery' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: error: Signing for "DKPhotoGallery-DKPhotoGallery" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'DKPhotoGallery-DKPhotoGallery' from project 'Pods')
    note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GoogleUtilitiesComponents' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'GoogleToolboxForMac' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'FMDB' from project 'Pods')
    /Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.0.99. (in target 'DKPhotoGallery' from project 'Pods')

    Result bundle written to path:
    	/var/folders/cc/3b8b8j7s3nd92qwt4_6zgzhh0000gn/T/flutter_tools.FkUIb7/flutter_ios_build_temp_dirCo3hLK/temporary_xcresult_bundle


Error (Xcode): Signing for "TOCropViewController-TOCropViewControllerBundle" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj

Error (Xcode): Signing for "DKImagePickerController-DKImagePickerController" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj

Error (Xcode): Signing for "DKPhotoGallery-DKPhotoGallery" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/blue492/StudioProjects/app/ios/Pods/Pods.xcodeproj

Encountered error while building for device.
Process finished with exit code 1

blue492 avatar Sep 26 '22 15:09 blue492

@blue492 it seems like the package is asking higher iOS target.

What's your target? It's in podfile, beginning of the file, in the line: Probably it's commented out or less than 11. You can set 11 there. platform :ios, 'X.0'

I'm also manually increasing with the Podfile script.

    if Gem::Version.new('11.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
     end

image

mirkancal avatar Sep 26 '22 15:09 mirkancal

Released version 5.4.3+8 with pull request merged!

pichillilorenzo avatar Oct 03 '22 12:10 pichillilorenzo

After updating Xcode to 14 version, I get this error and fixed it by changing in Podfile platform:ios to 14

  • open folder ios
  • open Podfile
  • in Podfile uncomment line number 2 and change "platform :ios, '14.0'"
Screenshot 2022-12-19 at 16 45 21

Anna-Myzukina avatar Dec 19 '22 15:12 Anna-Myzukina

I was getting the same error, and i had to update @stripe/stripe-react-native: Screenshot 2023-03-21 at 4 02 46 pm

then i updated cocoapods with: pod update

and change the platform :ios to '13.0'

Screenshot 2023-03-21 at 4 04 43 pm

jcpriascRZ avatar Mar 21 '23 05:03 jcpriascRZ

@mirkancal but this means that you only support iOS 14 and higher

I used another git repo wich already has the fix included as workaround

flutter_inappwebview: git: https://github.com/CodeEagle/flutter_inappwebview

this repo not exits.

lyf571321556 avatar Mar 28 '23 11:03 lyf571321556

this was helpfull. Thanks:)

simranchawla20 avatar Dec 05 '23 13:12 simranchawla20