Skip to content

Commit b1e6cd9

Browse files
authored
Merge pull request #657 from TheWirv/master
Add ATT workaround to docs
2 parents 637eb49 + 8591680 commit b1e6cd9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@ pre_install do |installer|
146146
end
147147
```
148148

149+
#### Workaround for "App Tracking Transparency not requestable on mount, starting at iOS 15.0" issue:
150+
151+
On iOS 15.0+ requesting App Tracking Transparency does not seem to work on mount (see [#648](https://github.com/zoontek/react-native-permissions/issues/648)). We can work around this by listening for app state change, and then requesting it when the app becomes `'active'`:
152+
153+
```js
154+
useEffect(() => {
155+
const listener = AppState.addEventListener("change", (status) => {
156+
if (Platform.OS === "ios" && status === "active") {
157+
request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY)
158+
.then((result) => console.log(result))
159+
.catch((error) => console.log(error));
160+
}
161+
});
162+
163+
return listener.remove;
164+
}, []);
165+
```
166+
149167
### Android
150168

151169
Add all wanted permissions to your app `android/app/src/main/AndroidManifest.xml` file:
@@ -777,7 +795,7 @@ checkNotifications().then(({status, settings}) => {
777795

778796
Request notifications permission status and get notifications settings values.
779797

780-
You cannot request notifications permissions on Windows. Disabling or enabling notifications can only be done through the App Settings.
798+
You cannot request notifications permissions on Windows. Disabling or enabling notifications can only be done through the App Settings.
781799
You cannot request notifications permissions on Android. `requestNotifications` is the same than `checkNotifications` on this platform.
782800

783801
```ts

0 commit comments

Comments
 (0)