Skip to content

Commit 8591680

Browse files
author
Marcel Lasaj
committed
Added ATT workaround to docs
1 parent 1817279 commit 8591680

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:
@@ -770,7 +788,7 @@ checkNotifications().then(({status, settings}) => {
770788

771789
Request notifications permission status and get notifications settings values.
772790

773-
You cannot request notifications permissions on Windows. Disabling or enabling notifications can only be done through the App Settings.
791+
You cannot request notifications permissions on Windows. Disabling or enabling notifications can only be done through the App Settings.
774792
You cannot request notifications permissions on Android. `requestNotifications` is the same than `checkNotifications` on this platform.
775793

776794
```ts

0 commit comments

Comments
 (0)