mapbox / mapbox/mapbox-gl-js

WKWebView vs UIWebView

Open
#7,498 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle: environment-specific :desktop_computer:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

mapbox-gl-js version:

Question

Currently using MapboxGL (0.50.0) within a Cordova (8.1.2) app ( I understand that using the iOS SDK is probably the best option, but due to time constraints and limited resources, we're trying to get one codebase to work across multiple environments for now ). The current iOS platform version is 4.5.5.

Will start by saying that MapboxGL is working spectacularly in browser, and Android. It had also been working great in UIWebView on iOS.

Unfortunately, after getting off of UIWebView in favor of WKWebView, the map loads but does not include any of the styles/details/terrain/etc. IE: The continents are rendered but no relevant information shows.

Note: We're not using any fancy/custom styles. Have tried the basic template, and streets/v10.

The app is loaded via file:// ... I know there are some known issues with XHR requests in WKWebView (as a result I am using https://github.com/oracle/cordova-plugin-wkwebview-file-xhr ). I'm not sure if there's something going on there that is preventing the style URL from being fetched. With that being said, I even tried hard-coding the style JSON directly into the mapbox initialization ie:

    this.map = new mapboxgl.Map({
      container: this.mapIdentifier,
      style: {...MASSIVE JSON BLOB ...},
    });

... but saw the exact same results.

If anyone on your team has seen this kind of problem or is aware of any issues between mapbox-gl and iOS WKWebView, I'd greatly appreciate any advice.

Thank you!

Links to related documentation

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the mapbox-gl 0.50.0 behavior in the stated Cordova 8.1.2, iOS 4.5.5 WKWebView setup, comparing file:// loading with the hard-coded style JSON; done means identifying the cause and documenting or verifying a focused fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile-dev, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.