set up NATIVE iOS mapbox navigation SDK in EXPO

0
1
set up NATIVE iOS mapbox navigation SDK in EXPO


Is there any means to make use of the native iOS mapbox navigation sdk in an expo module WITHOUT utilizing a 3rd celebration expo or react-native package deal?

I am following this expo information on Wrap third-party native libraries , attempting to make use of the mapbox ios navigation sdk, which appears to be solely out there through SPM, not Cocoapods (right here mapbox says “CocoaPods help is at present in improvement and can be added in future variations.”).

I’ve arrange the ~/.netrc file with my non-public mapbox key.
I’ve additionally created a config plugin that efficiently provides all vital values to the Data.plist recordsdata as instructed within the Mission Configuration half.

That is my config plugin withMapboxToken.js:

const { withInfoPlist } = require('@expo/config-plugins');

const withMapboxToken = (config) => {
  return withInfoPlist(config, (config) => {
    // Add Mapbox entry token
    config.modResults.MBXAccessToken = course of.env.MAPBOX_PUBLIC_TOKEN;
    
    // Add location permissions
    config.modResults.NSLocationWhenInUseUsageDescription = 
      "Reveals your location on the map and helps enhance the map.";
    
    config.modResults.NSLocationAlwaysAndWhenInUseUsageDescription = 
      "Reveals your location on the map and helps enhance the map.";

    // Add background modes for audio and site updates
    if (!config.modResults.UIBackgroundModes) {
      config.modResults.UIBackgroundModes = [];
    }
    
    if (!config.modResults.UIBackgroundModes.consists of('audio')) {
      config.modResults.UIBackgroundModes.push('audio');
    }
    
    if (!config.modResults.UIBackgroundModes.consists of('location')) {
      config.modResults.UIBackgroundModes.push('location');
    }

    console.log('✅ Mapbox token and permissions configured');
    return config;
  });
};

module.exports = withMapboxToken; 

There appears to be no downside regarding the linking/bridging between native iOS and XCode, as I efficiently managed to jot down a Easy “Hey World” view in Swift, which reveals up within the expo improvement construct.
Now, when attempting to put in the SDK, this appears to be the half the place I fail.
I first tried all methods I may assume (handbook set up in XCode, or utilizing a Bundle.swift file) of to first MANUALLY set up the SDK and have a improvement construct working on my iPhone with none issues.

Remember the fact that I am utilizing expo managed workflow, so the ios/ and android/ folders are mechanically generated and should not be manually modified, I even have them in my .gitignore. I simply needed to strive manually putting in the SDK first, earlier than attempting to automate this for instance through a config plugin or a script that I run after prebuild and earlier than creating a brand new improvement construct.

When attempting to run npx expo run:ios --device , I get this error within the output:

  1 | import ExpoModulesCore
> 2 | import MapboxDirections
    |        ^ no such module 'MapboxDirections'
  3 | import MapboxNavigationCore
  4 | import MapboxNavigationUIKit
  5 | import UIKit

› Compiling expo-linking Pods/ExpoLinking » ExpoLinking-dummy.m

› 1 error(s), and 1 warning(s)

CommandError: Didn't construct iOS undertaking. "xcodebuild" exited with error code 65.

So it appears to me the Swift package deal(s) haven’t been accurately put in.
And that is what the “Bundle Dependencies” a part of my XCode Mission Navigator appears to be like like:
8

LEAVE A REPLY

Please enter your comment!
Please enter your name here