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

Swap download scripts for explicit Mapbox-iOS-SDK pod dependency #1533

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions example/ios/RNMapboxGLExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 */ = {
Expand Down Expand Up @@ -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 */
Expand Down
24 changes: 18 additions & 6 deletions ios/RCTMGL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
38 changes: 5 additions & 33 deletions ios/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.

Expand All @@ -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`.
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion react-native-mapbox-gl.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 0 additions & 18 deletions scripts/download-mapbox-gl-native-ios-if-on-mac.js

This file was deleted.

37 changes: 0 additions & 37 deletions scripts/download-mapbox-gl-native-ios.sh

This file was deleted.