@nacrejs/core-location
v0.0.1
Published
Nacre 的定位能力:使用 App 期间的位置。装了才有 CLLocationManager
Readme
@nacrejs/core-location
A capability package for Nacre, a JavaScript runtime for iOS apps: the device location while the app is in use. It provides CLLocationManager and CLLocation. The app has it only if the project installs this package.
Install
In a Nacre project, three steps.
1. Install the package.
npm install @nacrejs/core-location2. Bring in its types at the top of the entry file.
/// <reference types="@nacrejs/types" />
/// <reference types="@nacrejs/core-location" />3. Write its usage description in nacre.config.json.
{
"ios": {
"infoPlist": {
"NSLocationWhenInUseUsageDescription": "Used to show stores near you"
}
}
}NSLocationWhenInUseUsageDescription is the sentence iOS shows the user when the app asks for location access. Only you can write it, so the package doesn't ship one. If it's missing, nacre generate stops with an error that names the key. See Writing usage descriptions.
Effect: after you regenerate ios/ and rebuild, the app includes this capability, and typeof CLLocationManager !== 'undefined' is true.
Without the package, its classes don't exist: reading one throws ReferenceError, and type checking reports it first.
For how to use it, see Location. For all capability packages, see Core and capability packages.
License
FSL-1.1-MIT, see LICENSE.md.
