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.27k stars 1.61k forks source link

Incompatibility with ios17 #1783

Closed kjxbyz closed 1 year ago

kjxbyz commented 1 year ago

Environment

Technology Version
Flutter version 3.13.4
Plugin version 5.7.2+3
Android version
iOS version 17
macOS version 13.5.2
Xcode version 15

Device information:

Description

Expected behavior:

Current behavior:

Launching lib/main.dart on iPhone 15 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           101.6s
Failed to build iOS app
Error (Xcode): type argument 'nw_proxy_config_t' (aka 'struct nw_proxy_config *') is neither an Objective-C object nor a block type
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h:119:46

Parse Issue (Xcode): Could not build module 'WebKit'
/Users/ying/work/app/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:893:8

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.

Steps to reproduce

  1. This
  2. Than that
  3. Then

Images

Stacktrace/Logcat

github-actions[bot] commented 1 year ago

👋 @kjxbyz

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!

tom-quiltt commented 1 year ago

Might be related to https://github.com/pichillilorenzo/flutter_inappwebview/issues/1735 but I can't do the workaround: https://github.com/pichillilorenzo/flutter_inappwebview/issues/1735#issuecomment-1683434110

redfish31 commented 1 year ago

Hi,

I have the same problem but on a real device (iPhone 12 Pro with iOS 17).

redfish31 commented 1 year ago

Might be related to #1735 but I can't do the workaround: #1735 (comment)

It's not the same error and it's not fixed the problem for us 😢

RMatushkin commented 1 year ago

Might be related to #1735 but I can't do the workaround: #1735 (comment)

It's not the same error and it's not fixed the problem for us 😢

Bro, you are most likely doing something wrong. Right now I did what is written in this comment https://github.com/pichillilorenzo/flutter_inappwebview/issues/1735#issuecomment-1699023475, tested it on iOS 17, everything works fine through Xcode 15 (release version).

RMatushkin commented 1 year ago

I wrote a small script to make this temporary fix. This script works fine in the Codemagic Pre-build script phase.

#!/bin/bash

echo "Temporary fix for 'WKWebsiteDataStore.h'"

file_path="/Applications/Xcode-15.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Cryptexes/OS/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h"

if [ ! -e "$file_path" ]; then
  echo "File not found: $file_path"
  exit 1
fi

chmod u+w "$file_path"

if [ $? -eq 0 ]; then
  echo "File permissions changed successfully"
else
  echo "Error: Changing file permissions failed"
  exit 1
fi

sed -i '' 's/__IPHONE_OS_VERSION_MAX_ALLOWED >= 170000/__IPHONE_OS_VERSION_MAX_ALLOWED >= 180000/g' "$file_path"

if [ $? -eq 0 ]; then
  echo "Replacement completed successfully"
else
  echo "Error: Replacement encountered an error"
  exit 1
fi

chmod u-w "$file_path"
eziochiu commented 1 year ago

I add this line s.ios.deployment_target = '8.0' solved the problem

alarkirikal commented 1 year ago

I wrote a small script to make this temporary fix. This script works fine in the Codemagic Pre-build script phase.

#!/bin/bash

echo "Temporary fix for 'WKWebsiteDataStore.h'"

file_path="/Applications/Xcode-15.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Cryptexes/OS/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h"

if [ ! -e "$file_path" ]; then
  echo "File not found: $file_path"
  exit 1
fi

chmod u+w "$file_path"

if [ $? -eq 0 ]; then
  echo "File permissions changed successfully"
else
  echo "Error: Changing file permissions failed"
  exit 1
fi

sed -i '' 's/__IPHONE_OS_VERSION_MAX_ALLOWED >= 170000/__IPHONE_OS_VERSION_MAX_ALLOWED >= 180000/g' "$file_path"

if [ $? -eq 0 ]; then
  echo "Replacement completed successfully"
else
  echo "Error: Replacement encountered an error"
  exit 1
fi

chmod u-w "$file_path"

These fixes are great, but this isn't a clean solution, when you have to modify a dependency code on your own in a pre-build step, not to mention about playing around with file ownership..

DeanFs commented 1 year ago

I have the same problem

redfish31 commented 1 year ago

@RMatushkin You're solution is good for the build but it's not working for local debug. When I'm trying to "flutter run ios", I have this error :

Error (Xcode): type argument 'nw_proxy_config_t' (aka 'struct nw_proxy_config *') is neither an Objective-C object nor a block type /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h:119:46

Parse Issue (Xcode): Could not build module 'WebKit' /Users/xavier/IdeaProjects/app_mobile/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:893:8

Parse Issue (Xcode): Could not build module 'WebKit' /Users/xavier/IdeaProjects/app_mobile/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:285:8

Could not build the application for the simulator. Error launching application on iPad Pro (12.9-inch) (6th generation).

RMatushkin commented 1 year ago

@RMatushkin You're solution is good for the build but it's not working for local debug. When I'm trying to "flutter run ios", I have this error :

Error (Xcode): type argument 'nw_proxy_config_t' (aka 'struct nw_proxy_config *') is neither an Objective-C object nor a block type /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebsiteDataStore.h:119:46 Parse Issue (Xcode): Could not build module 'WebKit' /Users/xavier/IdeaProjects/app_mobile/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:893:8 Parse Issue (Xcode): Could not build module 'WebKit' /Users/xavier/IdeaProjects/app_mobile/build/ios/Debug-iphonesimulator/flutter_inappwebview/flutter_inappwebview.framework/Headers/flutter_inappwebview-Swift.h:285:8 Could not build the application for the simulator. Error launching application on iPad Pro (12.9-inch) (6th generation).

Don't see a problem with it, you can create .sh script locally, and execute it with 'sudo' to have permission for editing. But if you use iOS simulator, you have to edit the same file but in iPhoneSimulator.platform folder because the script I wrote it edits just the file for physical devices.

redfish31 commented 1 year ago

I'm so stupid ! You're right ! It's working now 🤩 Thx !!

GeceGibi commented 1 year ago

Any changes ?

nesquikm commented 1 year ago

Any changes ?

Fixed in #1790

roshansrashtasoft commented 1 year ago

Screenshot 2023-09-26 at 12 24 55

Any Solution I am Stuck 😢 ?

kjxbyz commented 1 year ago
flutter_inappwebview:
     git:
      url: https://github.com/nesquikm/flutter_inappwebview
      ref: heads/v5.7.2+3_fix_xcode_17
alarkirikal commented 1 year ago

Or just start using https://pub.dev/packages/webview_flutter instead of referencing some branches on a dependency that hasn't been updated in 9 months (not counting pre-release versions) :)

roshansrashtasoft commented 1 year ago
flutter_inappwebview:
     git:
      url: https://github.com/nesquikm/flutter_inappwebview
      ref: heads/v5.7.2+3_fix_xcode_17

@kjxbyz I am Already Using the v5.7.2+3 Version. Any Other Solution?

kjxbyz commented 1 year ago

@roshansrashtasoft pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_inappwebview:
    git:
      url: https://github.com/nesquikm/flutter_inappwebview
      ref: heads/v5.7.2+3_fix_xcode_17
  flutter_localizations:
    sdk: flutter
  intl: ^0.18.1
pacharapold commented 1 year ago

@roshansrashtasoft pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_inappwebview:
    git:
      url: https://github.com/nesquikm/flutter_inappwebview
      ref: heads/v5.7.2+3_fix_xcode_17
  flutter_localizations:
    sdk: flutter
  intl: ^0.18.1

I attempted to add that solution to the pubspec.yaml file, but I encountered the same error. Are there any alternative solutions available?

kjxbyz commented 1 year ago

Please provide a minimal reproducible example.

jiqimao3528 commented 1 year ago

@roshansrashtasoft pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_inappwebview:
    git:
      url: https://github.com/nesquikm/flutter_inappwebview
      ref: heads/v5.7.2+3_fix_xcode_17
  flutter_localizations:
    sdk: flutter
  intl: ^0.18.1

Thank you, I use this solution, solved the problem

felipecastrosales commented 1 year ago

any expectations about the new release @pichillilorenzo?

pichillilorenzo commented 1 year ago

Released new version 5.8.0 and 6.0.0-beta.25 with the fix!

pengkhieng commented 1 year ago

I have the same problem. But now it work well just upgrade flutter and use command:

flutter pub upgrade

github-actions[bot] commented 3 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.