Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS APP - How to use service worker (fetch intercept) #2527

Open
1 of 2 tasks
linpengteng opened this issue Feb 11, 2025 · 0 comments
Open
1 of 2 tasks

IOS APP - How to use service worker (fetch intercept) #2527

linpengteng opened this issue Feb 11, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@linpengteng
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In IOS APP, I configured according to the following instructions. However, although the service worker appears to be available, it cannot intercept network requests through self.addEventListener ('fetch ', ()=>{/*... */}). Help!!!

iOS App-Bound Domains
Read the WebKit - App-Bound Domains article for details.

You can specify up to 10 "app-bound" domains using the new Info.plist key WKAppBoundDomains, for example:

<dict>
<key>WKAppBoundDomains</key>
<array>
<string>flutter.dev</string>
<string>github.com</string>
</array>
</dict>

After that, you need to set to true the limitsNavigationsToAppBoundDomains iOS-specific WebView option, for example:

InAppWebViewGroupOptions(
ios: IOSInAppWebViewOptions(
limitsNavigationsToAppBoundDomains: true // adds Service Worker API on iOS 14.0+
)
)

Expected Behavior

self.addEventListener ('fetch ', ()=>{/*... */}) is work

Steps with code example to reproduce

None

Stacktrace/Logs

None

Flutter version

3.17.0-0.0.pre

Operating System, Device-specific and/or Tool

IOS 18.2.x

Plugin version

^5.4.4+3

Additional information

No response

Self grab

  • I'm ready to work on this issue!
@linpengteng linpengteng added the bug Something isn't working label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant