Closed kiddkevin00 closed 5 years ago
Why manual setup? Use react-native link
Show my your ios/Podfile
I try react-native link first but it doesnt work so that why I then do manual setup on top of react-native link
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'pacesetter' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/2.8.4",
:subspecs => [
"Core"
],
:inhibit_warnings => true
pod 'EXAdsAdMob',
:path => "../node_modules/expo-ads-admob/ios"
pod 'EXSegment',
:path => "../node_modules/expo-analytics-segment/ios"
pod 'EXBarCodeScanner',
:path => "../node_modules/expo-barcode-scanner/ios"
pod 'EXBarCodeScannerInterface',
:path => "../node_modules/expo-barcode-scanner-interface/ios"
pod 'EXCamera',
:path => "../node_modules/expo-camera/ios"
pod 'EXCameraInterface',
:path => "../node_modules/expo-camera-interface/ios"
pod 'EXConstants',
:path => "../node_modules/expo-constants/ios"
pod 'EXConstantsInterface',
:path => "../node_modules/expo-constants-interface/ios"
pod 'EXContacts',
:path => "../node_modules/expo-contacts/ios"
pod 'EXCore',
:path => "../node_modules/expo-core/ios"
pod 'EXFaceDetectorInterface',
:path => "../node_modules/expo-face-detector-interface/ios"
pod 'EXFileSystem',
:path => "../node_modules/expo-file-system/ios"
pod 'EXFileSystemInterface',
:path => "../node_modules/expo-file-system-interface/ios"
pod 'EXFont',
:path => "../node_modules/expo-font/ios"
pod 'EXFontInterface',
:path => "../node_modules/expo-font-interface/ios"
pod 'EXGL-CPP',
:path => "../node_modules/expo-gl-cpp/cpp"
pod 'EXImageLoaderInterface',
:path => "../node_modules/expo-image-loader-interface/ios"
pod 'EXLocalAuthentication',
:path => "../node_modules/expo-local-authentication/ios"
pod 'EXLocation',
:path => "../node_modules/expo-location/ios"
pod 'EXMediaLibrary',
:path => "../node_modules/expo-media-library/ios"
pod 'EXPermissions',
:path => "../node_modules/expo-permissions/ios"
pod 'EXPermissionsInterface',
:path => "../node_modules/expo-permissions-interface/ios"
pod 'EXPrint',
:path => "../node_modules/expo-print/ios"
pod 'EXReactNativeAdapter',
:path => "../node_modules/expo-react-native-adapter/ios"
pod 'EXSensors',
:path => "../node_modules/expo-sensors/ios"
pod 'EXSensorsInterface',
:path => "../node_modules/expo-sensors-interface/ios"
pod 'EXSMS',
:path => "../node_modules/expo-sms/ios"
pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge",
"RCTLinkingIOS",
"RCTSettings"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
pod 'RNBackgroundGeolocation', :path => '../node_modules/react-native-background-geolocation'
pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
post_install do |installer|
installer.pods_project.main_group.tab_width = '2';
installer.pods_project.main_group.indent_width = '2';
installer.pod_targets.each do |target|
if target.pod_name == 'ExpoKit'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# needed for GoogleMaps 2.x
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
end
end
if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? target.pod_name
target.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
# Can't specify this in the React podspec because we need
# to use those podspecs for detached projects which don't reference ExponentCPP.
if target.pod_name.start_with?('React')
target.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
end
end
# Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
# RCT_ENABLE_PACKAGER_CONNECTION disabled
next unless target.pod_name == 'React'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
end
end
end
end
$ cd ios
$ rm Podfile.lock
$ pod install
Show me the entire output.
➜ ios git:(spike_geolocation) ✗ pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `EXAdsAdMob` from `../node_modules/expo-ads-admob/ios`
Fetching podspec for `EXBarCodeScanner` from `../node_modules/expo-barcode-scanner/ios`
Fetching podspec for `EXBarCodeScannerInterface` from `../node_modules/expo-barcode-scanner-interface/ios`
Fetching podspec for `EXCamera` from `../node_modules/expo-camera/ios`
Fetching podspec for `EXCameraInterface` from `../node_modules/expo-camera-interface/ios`
Fetching podspec for `EXConstants` from `../node_modules/expo-constants/ios`
Fetching podspec for `EXConstantsInterface` from `../node_modules/expo-constants-interface/ios`
Fetching podspec for `EXContacts` from `../node_modules/expo-contacts/ios`
Fetching podspec for `EXCore` from `../node_modules/expo-core/ios`
Fetching podspec for `EXFaceDetectorInterface` from `../node_modules/expo-face-detector-interface/ios`
Fetching podspec for `EXFileSystem` from `../node_modules/expo-file-system/ios`
Fetching podspec for `EXFileSystemInterface` from `../node_modules/expo-file-system-interface/ios`
Fetching podspec for `EXFont` from `../node_modules/expo-font/ios`
Fetching podspec for `EXFontInterface` from `../node_modules/expo-font-interface/ios`
Fetching podspec for `EXGL-CPP` from `../node_modules/expo-gl-cpp/cpp`
Fetching podspec for `EXImageLoaderInterface` from `../node_modules/expo-image-loader-interface/ios`
Fetching podspec for `EXLocalAuthentication` from `../node_modules/expo-local-authentication/ios`
Fetching podspec for `EXLocation` from `../node_modules/expo-location/ios`
Fetching podspec for `EXMediaLibrary` from `../node_modules/expo-media-library/ios`
Fetching podspec for `EXPermissions` from `../node_modules/expo-permissions/ios`
Fetching podspec for `EXPermissionsInterface` from `../node_modules/expo-permissions-interface/ios`
Fetching podspec for `EXPrint` from `../node_modules/expo-print/ios`
Fetching podspec for `EXReactNativeAdapter` from `../node_modules/expo-react-native-adapter/ios`
Fetching podspec for `EXSMS` from `../node_modules/expo-sms/ios`
Fetching podspec for `EXSegment` from `../node_modules/expo-analytics-segment/ios`
Fetching podspec for `EXSensors` from `../node_modules/expo-sensors/ios`
Fetching podspec for `EXSensorsInterface` from `../node_modules/expo-sensors-interface/ios`
Pre-downloading: `ExpoKit` from `http://github.com/expo/expo.git`, tag `ios/2.8.4`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `RNBackgroundFetch` from `../node_modules/react-native-background-fetch`
Fetching podspec for `RNBackgroundGeolocation` from `../node_modules/react-native-background-geolocation`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Using Amplitude-iOS (3.14.1)
Using Analytics (3.6.10)
Using AppAuth (0.95.0)
Using Bolts (1.9.0)
Using Branch (0.24.2)
Using CocoaLumberjack (3.2.1)
Using Crashlytics (3.12.0)
Using DoubleConversion (1.1.5)
Using EXAdsAdMob (1.0.0)
Using EXBarCodeScanner (1.0.0)
Using EXBarCodeScannerInterface (1.0.0)
Using EXCamera (1.1.1)
Using EXCameraInterface (1.0.2)
Using EXConstants (1.0.2)
Using EXConstantsInterface (1.0.2)
Using EXContacts (1.0.0)
Using EXCore (1.1.0)
Using EXFaceDetectorInterface (1.0.2)
Using EXFileSystem (1.0.2)
Using EXFileSystemInterface (1.0.2)
Using EXFont (1.0.0)
Using EXFontInterface (1.0.0)
Using EXGL-CPP (1.0.2)
Using EXImageLoaderInterface (1.0.0)
Using EXLocalAuthentication (1.0.0)
Using EXLocation (1.0.0)
Using EXMediaLibrary (1.0.0)
Using EXPermissions (1.1.0)
Using EXPermissionsInterface (1.1.0)
Using EXPrint (1.0.0)
Using EXReactNativeAdapter (1.1.1)
Using EXSMS (1.0.2)
Using EXSegment (1.0.0)
Using EXSensors (1.0.2)
Using EXSensorsInterface (1.0.2)
Installing ExpoKit 2.8.4
Using FBAudienceNetwork (4.99.0)
Using FBSDKCoreKit (4.40.0)
Using FBSDKLoginKit (4.40.0)
Using FBSDKShareKit (4.40.0)
Using Fabric (1.9.0)
Using Folly (2016.09.26.00)
Using Google-Maps-iOS-Utils (2.1.0)
Using Google-Mobile-Ads-SDK (7.22.0)
Using GoogleAppUtilities (1.1.2)
Using GoogleAuthUtilities (2.0.2)
Using GoogleMaps (2.5.0)
Using GoogleNetworkingUtilities (1.2.2)
Using GoogleSignIn (3.0.0)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleUtilities (1.3.2)
Using JKBigInteger2 (0.0.5)
Using RNBackgroundFetch (2.5.4)
Using RNBackgroundGeolocation (3.0.2)
Using React (0.55.4)
Using boost-for-react-native (1.63.0)
Using glog (0.3.4)
Using lottie-ios (2.5.2)
Using yoga (0.55.4.React)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 49 dependencies from the Podfile and 59 total pods installed.
One error this time:
Remove react-native-background-geolocation
and get your app to boot without it first.
Yes, it is able to run before I install react-native-background-geolocation
. You saying I need to revert back?
Yes I saw this and I try the solution there but still same error and this is what I have:
What else should I do now? If I revert back, can you give me step by step how to set it up?
I am asking this because I have been re-trying several times following your guide for the past couple days and still going nowhere.
No idea. I hate Expo.
I suggest you first try a Hello World project with only background-geolocation installed in isolation.
But I've ejected from Expo. Ejected Expo app should just be a React Native app with some library on top of it. So you saying there is no way to integrate background-geolocation with ejected Expo app?
So you saying there is no way to integrate background-geolocation with ejected Expo app?
No that's not what I'm saying.
Create a Hello World Expo app.
Ok and then npm run eject
, npm install background-geolocation
, react-native link
, then build/run on XCode, right?
yes
Run in foo.xcodeproj or foo.xcworkspace ?
If your app has a Podfile
, you always use .xcworkspace
after npm run eject, npm install background-geolocation, react-native link, I build/run on XCode, and I got this
And use react-native link
after your Podfile
exists.
And of course, after using react-native link
, one always run pod install
.
ok the above is from .xcworkspace. after react-native link
. It doesnt generate anything in Pods folder so it is still empty
how to make Podfile exist? pod init?
It's assumed you have a valid, non-empty Podfile
before you install the plugin.
if you don't have a Podfile, open xcodeproj
Then I get this:
destroy your app and start all over again.
Does an ejected Hello World Expo app contain an ios/Podfile
. I know nothing of Expo, except that I hate it.
It does have a pod file inside ios folder
After react-native link should i do pod install
?
I got this error when running react-native link react-native-background-geolocation
:
What should I do?
Ok but why and most importantly how to resolve it?
Ah...don't use the word "test" when naming your project. The install script gets confused with the Test iOS Target
Got it. Create a new project called foo this time. The first link passed but not the second - react-native link react-native-background-fetch
Failing here
groupName = xcodeProjectDirectory.replace('.xcodeproj', '');
const projectGroup = project.findPBXGroupKey({ name: groupName });
project.addSourceFile(
pathToAppdelegateExtension,
{ target: project.getFirstTarget().uuid },
projectGroup
);
Edit node_modules/react-native-background-fetch/scripts/postlink.js
and send out some console.log
of those variables being referenced. Find out which of them is null
.
groupName
projectGroup
pathToAppdelegateExtension
project.getFirstTarget().uuid
After making a change:
$ react-native unlink react-native-background-fetch
$ react-native link react-native-background-fetch
You will probably see a similar error each time you unlink, ignore it.
projectGroup
is undefined
show me the output of groupName
groupName is foo
pathToAppdelegateExtension is ../node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m
uuis is B56386401DB9693800A0598C
You created this foo
app from scratch after test
failed? You didn't just try to rename it?
I create a new one from scratch expo init foo npm run eject npm i background... react-native link ..background react-native link ..fetch
cp -R foo foo2
cd foo2
rm -rf node_modules
zip up foo2 and email it to me @ chris@transistorsoft.com
and just for kicks, create a vanilla RN project:
$ react-native init rnfoo
Link the plugins as you've been doing. Open the xcodeproj
I sent to your email and yes, react-native init rnfoo
is woking fine in my mac
Are each of these setups mutually exclusive?
When react-native link
detects a Podfile, it will automatically perform the Cocoapod install.
react-native link
does it all.
Ok but using manual setup + pod install should still work right?
Ok but using manual setup + pod install should still work right?
You pick 1 of the 3 install methods and follow the directions.
Your Environment
react-native -v
): 0.55.4Expected Behavior
After following your instruction to install react-native-background-geolocation, the app should still be able to run from XCode
Actual Behavior
I keep getting the following two errors when building the app from XCode:
React/RCTEventEmitter.h file not found
Build input file cannot be found: '/Users/hsum/Desktop/.../ios/node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m'
Steps to Reproduce
$ npm run eject
Context
Install react-native-background-geolocation to my ejected Expo app and get it running on iPhone Simulator.
Debug logs