@nacrejs/app-tracking-transparency
v0.0.1
Published
Nacre 的跟踪授权和广告标识:ATTrackingManager、ASIdentifierManager。装了才有这两个类
Readme
@nacrejs/app-tracking-transparency
A capability package for Nacre, a JavaScript runtime for iOS apps: tracking authorization and the advertising identifier. It provides ATTrackingManager and ASIdentifierManager. 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/app-tracking-transparency2. Bring in its types at the top of the entry file.
/// <reference types="@nacrejs/types" />
/// <reference types="@nacrejs/app-tracking-transparency" />3. Write its usage description in nacre.config.json.
{
"ios": {
"infoPlist": {
"NSUserTrackingUsageDescription": "Used to show you more relevant ads"
}
}
}NSUserTrackingUsageDescription is the sentence iOS shows the user when the app asks for permission to track. 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 ATTrackingManager !== '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 Tracking authorization and advertising identifier. For all capability packages, see Core and capability packages.
License
FSL-1.1-MIT, see LICENSE.md.
