Skip to content

Commit

Permalink
Update to Mapbox-iOS-SDK 6.3.0 (#513)
Browse files Browse the repository at this point in the history
* Update to Mapbox-iOS-SDK 6.3.0

The 6.0.0 upgrade had no breaking changes:

> This major release does not include any breaking changes to public
> APIs. We are treating this release as a SEMVER major change because
> our installation instructions have changed.
https://github.com/mapbox/mapbox-gl-native-ios/releases/tag/ios-v6.0.0

I did however need to cast the `accessToken` as a `String` to satisfy
the compiler after this upgrade.

Prior to the upgrade I was seeing crashes from this bug, which was fixed
in 6.2: mapbox/mapbox-gl-native-ios#485

So far I don't see any issues at all after the upgrade.

Developers will need to configure their access token in order to fetch
the mapbox sdk for this an future versions, described here:
https://docs.mapbox.com/ios/maps/guides/install/

* Setup .netrc for iOS mapbox sdk download

Writes a `~/.netrc` file containing the credentials needed to download
the iOS mapbox sdk. I'm not experienced with github workflow so I'm just
hoping that I can write to the home directory of whatever container it
runs in. This should allow curl to find and use the given credentials.

Co-authored-by: tobrun <tobrun.van.nuland@gmail.com>
  • Loading branch information
n8han and tobrun authored Apr 12, 2021
1 parent 2259e76 commit cc0bbe9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/flutter_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
SDK_REGISTRY_TOKEN: ${{ secrets.SDK_REGISTRY_ANDROID}}

build-iOS:
environment: ANDROID_CI_DOWNLOADS_TOKEN
name: Build iOS package
runs-on: macos-latest

Expand All @@ -47,9 +48,14 @@ jobs:
- run: flutter pub get
- name: build iOS package
run: |
echo "machine api.mapbox.com
login mapbox
password $SDK_REGISTRY_TOKEN" >> ~/.netrc
cd ./example
flutter build ios --release --no-codesign
env:
SDK_REGISTRY_TOKEN: ${{ secrets.SDK_REGISTRY_IOS}}

build-web:
name: "Build web"
runs-on: ubuntu-latest
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This Flutter plugin allows to show embedded interactive and customizable vector

- Install [Flutter](https://flutter.io/get-started/) and validate its installation with `flutter doctor`
- Clone the repository with `git clone git@github.com:tobrun/flutter-mapbox-gl.git`
- Add a Mapbox access token to the example app (see next section)
- Add a public Mapbox access token to the example app (see next section)
- Add a secret Mapbox access token for downloading the SDK
- Connect a mobile device or start an emulator, simulator or chrome
- Locate the id of a the device with `flutter devices`
- Run the app with `cd flutter_mapbox/example && flutter packages get && flutter run -d {device_id}`
Expand All @@ -25,6 +26,17 @@ The **recommended** way to provide your access token is through the `MapboxMap`

An alternative method to provide access tokens that was required until the v0.7 release is described in [this wiki article](https://github.com/tobrun/flutter-mapbox-gl/wiki/Mapbox-access-tokens).

### SDK Download token

You must also [configure a secret access token having the Download: read
scope][https://docs.mapbox.com/ios/maps/guides/install/]. If this configuration
is not present, an error like the following appears during the iOS build.

```
[!] Error installing Mapbox-iOS-SDK
curl: (22) The requested URL returned error: 401 Unauthorized
```

## Avoid Android UnsatisfiedLinkError

Update buildTypes in `android\app\build.gradle`
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/MapboxMapController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MapboxMapController: NSObject, FlutterPlatformView, MGLMapViewDelegate, Ma

init(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?, registrar: FlutterPluginRegistrar) {
if let args = args as? [String: Any] {
if let token = args["accessToken"] as? NSString{
if let token = args["accessToken"] as? String {
MGLAccountManager.accessToken = token
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/mapbox_gl.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A new Flutter plugin.
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'MapboxAnnotationExtension', '~> 0.0.1-beta.1'
s.dependency 'Mapbox-iOS-SDK', '~> 5.6.0'
s.dependency 'Mapbox-iOS-SDK', '~> 6.3.0'
s.swift_version = '4.2'
s.ios.deployment_target = '9.0'
end
Expand Down

0 comments on commit cc0bbe9

Please sign in to comment.