Setup iOS for react-native-geolocation-service
masterFollow these steps to configure the library for iOS projects.
1) Linking
For React Native 0.60 or higher, manual linking is not required. After installing the package, run pod install from the ios directory to automatically pick up the package.
For RN 0.59 or below:
- Using Cocoapods: Update your
Podfilewith:
Then runpod 'react-native-geolocation-service', path: '../node_modules/react-native-geolocation-service'pod installfrom theiosdirectory. - Manual Linking: Drag
RNFusedLocation.xcodeprojinto your Xcode project (e.g., under the Libraries group) and add thelibRNFusedLocation.abinary to your project'sBuild Phases->Link Binary With Librariessection.
2) Enable Swift Support
The iOS implementation is written in Swift. You must add Swift support to your project via Xcode:
- Select
File -> New -> Filein Xcode. - Choose a Swift file and name it anything.
- When prompted, click Yes to generate a bridging header. This is required to update the Swift compiler flags.
3) Update info.plist
Add the required location usage descriptions to your info.plist.
- Standard usage: Add
NSLocationWhenInUseUsageDescription. - Background location usage: You must add all three keys below AND enable 'location' as a background mode in the
Signing & Capabilities -> Capabilitytab in Xcode:NSLocationWhenInUseUsageDescriptionNSLocationAlwaysUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescription
pod 'react-native-geolocation-service', path: '../node_modules/react-native-geolocation-service'