diff --git a/example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj b/example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj index dd010b3d8..7734d8103 100644 --- a/example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj +++ b/example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj @@ -1212,7 +1212,7 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-resources.sh", + "${PODS_ROOT}/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-resources.sh", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", @@ -1249,7 +1249,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { @@ -1290,16 +1290,18 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-frameworks.sh", - "${PODS_ROOT}/../../node_modules/@mapbox/react-native-mapbox-gl/ios/Mapbox.framework", + "${PODS_ROOT}/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-frameworks.sh", + "${PODS_ROOT}/Mapbox-iOS-SDK/dynamic/Mapbox.framework", + "${PODS_ROOT}/Mapbox-iOS-SDK/dynamic/Mapbox.framework.dSYM", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework", + "${DWARF_DSYM_FOLDER_PATH}/Mapbox.framework.dSYM", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNMapboxGLExample/Pods-RNMapboxGLExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/RCTMGL.xcodeproj/project.pbxproj b/ios/RCTMGL.xcodeproj/project.pbxproj index 6cd19b2c2..15d7e1dab 100644 --- a/ios/RCTMGL.xcodeproj/project.pbxproj +++ b/ios/RCTMGL.xcodeproj/project.pbxproj @@ -611,7 +611,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -654,7 +653,6 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; @@ -665,8 +663,15 @@ C4D144471F4E16F600396F26 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React/**"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../../../ios/Frameworks", + "$(PROJECT_DIR)/../../../ios/Pods", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../../../react-native/React/**", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -676,8 +681,15 @@ C4D144481F4E16F600396F26 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React/**"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/../../../ios/Frameworks", + "$(PROJECT_DIR)/../../../ios/Pods", + ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../../../react-native/React/**", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/ios/install.md b/ios/install.md index b9048c70f..7eb776be8 100644 --- a/ios/install.md +++ b/ios/install.md @@ -2,35 +2,10 @@ ## Using CocoaPods -To install with CocoaPods, add the following to your `Podfile`: +To install with CocoaPods, set up your `Podfile` following the [React Native CocoaPods instructions](https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies), then add the following line to your target's pods: ``` - # Flexbox Layout Manager Used By React Native - pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec' - - # React Native - pod 'React', path: '../node_modules/react-native', subspecs: [ - # Comment out any unneeded subspecs to reduce bundle size. - 'Core', - 'DevSupport', - 'RCTActionSheet', - 'RCTAnimation', - 'RCTBlob', - 'RCTCameraRoll', - 'RCTGeolocation', - 'RCTImage', - 'RCTNetwork', - 'RCTPushNotification', - 'RCTSettings', - 'RCTTest', - 'RCTText', - 'RCTVibration', - 'RCTWebSocket', - 'RCTLinkingIOS' - ] - - # Mapbox - pod 'react-native-mapbox-gl', :path => '../node_modules/@mapbox/react-native-mapbox-gl' +pod 'react-native-mapbox-gl', :path => '../node_modules/@mapbox/react-native-mapbox-gl' ``` Then run `pod install` and rebuild your project. @@ -39,7 +14,9 @@ Then run `pod install` and rebuild your project. ### Add Native Mapbox SDK Framework -Select your project in the `Project navigator`. Click `General` tab then add `node_modules/@mapbox/react-native-mapbox-gl/ios/Mapbox.framework` to `Embedded Binaries`. :collision: **Important, make sure you're adding it to general -> `Embedded Binaries` :collision:** +[Download a release of the Mapbox iOS SDK](https://github.com/mapbox/mapbox-gl-native/releases] (the target Mapbox-iOS-SDK version will be listed in `node_modules/@mapbox/react-native-mapbox-gl/react-native-mapbox-gl.podspec`, unzip it and copy `Mapbox.framework` into the `Frameworks` directory in your project. + +Select your project in the `Project navigator`. Click `General` tab then add `Frameworks/Mapbox.framework` to `Embedded Binaries`. :collision: **Important, make sure you're adding it to General -> `Embedded Binaries` :collision:** Click 'Add other' to open the file browser and select Mapbox.framework. @@ -52,11 +29,6 @@ Select the 'Copy items if needed' checkbox. In Xcode's `Project navigator`, right click on the `Libraries` folder ➜ `Add Files to <...>`. Add `node_modules/@mapbox/react-native-mapbox-gl/ios/RCTMGL.xcodeproj`. Then in Xcode navigate to `Build Phases` click on it and you should see `Link Binary with Libraries`, we need to add `libRCTMGL.a`. -### Add Framework Header Search Paths -In the `Build Settings` of your application target search for `FRAMEWORK_SEARCH_PATHS`. Add `$(PROJECT_DIR)/../node_modules/@mapbox/react-native-mapbox-gl/ios` non-recursive to your `Framework Search Paths`. - -**Important** If there is a select input under `Debug` line, choose `Any iOS SDK`. - ### Add Run Script In the `Build Phases` tab, click the plus sign and then `New Run Script Phase`. diff --git a/package.json b/package.json index 06ae74eb2..0378dc333 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,8 @@ "url": "https://github.com/mapbox/react-native-mapbox-gl" }, "scripts": { - "fetch:ios:sdk": "node ./scripts/download-mapbox-gl-native-ios-if-on-mac.js 3.7.8", "fetch:style:spec": ". ./scripts/download-style-spec.sh", "generate": "node ./scripts/autogenerate", - "preinstall": "npm run fetch:ios:sdk", "test": "npm run lint && npm run unittest", "unittest": "jest --coverage --verbose", "unittest:single": "jest --testNamePattern", diff --git a/react-native-mapbox-gl.podspec b/react-native-mapbox-gl.podspec index b3ecf4f71..60c006497 100644 --- a/react-native-mapbox-gl.podspec +++ b/react-native-mapbox-gl.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/mapbox/react-native-mapbox-gl.git" } s.source_files = "ios/RCTMGL/**/*.{h,m}" - s.vendored_frameworks = 'ios/Mapbox.framework' s.dependency 'React' + s.dependency 'Mapbox-iOS-SDK', '~> 3.7.8' end diff --git a/scripts/download-mapbox-gl-native-ios-if-on-mac.js b/scripts/download-mapbox-gl-native-ios-if-on-mac.js deleted file mode 100644 index eb8acc74d..000000000 --- a/scripts/download-mapbox-gl-native-ios-if-on-mac.js +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node - -var version = process.argv[2]; -var path = require('path'); - -// only download iOS SDK if on Mac OS -if (process.platform === 'darwin') { - var exec = require('child_process').exec; - var cmd = `"${path.join(__dirname, 'download-mapbox-gl-native-ios.sh')}" ${version}`; - exec(cmd, function(error, stdout, stderr) { - if (error) { - console.error(error); - return; - } - console.log(stdout); - console.log(stderr); - }); -} diff --git a/scripts/download-mapbox-gl-native-ios.sh b/scripts/download-mapbox-gl-native-ios.sh deleted file mode 100755 index 03f3e3f37..000000000 --- a/scripts/download-mapbox-gl-native-ios.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -cd ios/ - -VERSION=$1 -if type /usr/libexec/PlistBuddy &> /dev/null; then - CURRENT_VERSION=$(/usr/libexec/PlistBuddy -c "Print :MGLSemanticVersionString" Mapbox.framework/Info.plist) -else - CURRENT_VERSION=$(cat .framework_version) -fi - -if [ "$VERSION" == "$CURRENT_VERSION" ]; then - echo "The newest version is already installed. Exiting." - exit 0 -fi - -echo "Downloading Mapbox GL iOS $VERSION, this may take a minute." - -if ! which curl > /dev/null; then echo "curl command not found. Please install curl"; exit 1; fi; -if ! which unzip > /dev/null; then echo "unzip command not found. Please install unzip"; exit 1; fi; - -if [ -d ./Mapbox.framework ]; then - echo "Old Mapbox.framework found. Removing it and installing a $VERSION" - rm -rf ./Mapbox.framework -fi - -curl -sS https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-$VERSION-dynamic.zip > temp.zip -unzip -o temp.zip -d temp -mv temp/dynamic/Mapbox.framework ./Mapbox.framework -rm -r temp -rm temp.zip - -if ! [ -d ./Mapbox.framework ]; then - echo "Mapbox.framework not found. Please reinstall react-native-mapbox-gl"; exit 1; -fi; - -echo "$VERSION" > .framework_version