pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.12k stars 1.44k forks source link

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

Closed SethuSenthil closed 1 year ago

SethuSenthil commented 2 years ago

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

github-actions[bot] commented 2 years ago

👋 @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!

SethuSenthil commented 2 years ago

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

ghensto commented 2 years ago

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

SethuSenthil commented 2 years ago

@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.

mikhael28 commented 2 years ago

Code Eagle's open PR resolves this issue.

cimplesid commented 1 year ago

also exists on the Xcode 14.0 stable version

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

mirkancal commented 1 year ago

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

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

riegersan commented 1 year ago

@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

mirkancal commented 1 year ago

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

luan20495 commented 1 year ago

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

blue492 commented 1 year ago

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
mirkancal commented 1 year ago

@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

pichillilorenzo commented 1 year ago

Released version 5.4.3+8 with pull request merged!

Anna-Myzukina commented 1 year ago

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

Screenshot 2022-12-19 at 16 45 21
jcpriascRZ commented 1 year ago

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
lyf571321556 commented 1 year ago

@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.

simranchawla20 commented 8 months ago

this was helpfull. Thanks:)