Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request APP_TRACKING_TRANSPARENCY always return 'blocked' before user accept request #857

Closed
2 tasks done
Geoffrey63 opened this issue Mar 13, 2024 · 6 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@Geoffrey63
Copy link

Before submitting a new issue

  • I tested using the latest release of the library, as maybe the bug has been already fixed.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

Tested in the Example project from this repo : clicking on "Request" to request the PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY permission show the Snack with "blocked" directly after clicking the button and doesn't wait for user to answer the system permission pop-up.
Then clicking on "Allow" has no effect.

Tested equally inside our app and the behavior is identical.

Library version

4.1.4

Environment info

System:
  OS: macOS 14.3
  CPU: (10) arm64 Apple M1 Pro
  Memory: 218.86 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 19.9.0
    path: /var/folders/s9/k2twkc7n6xjg_rldxb1qtr_9568bbk/T/yarn--1710338064745-0.30628516454972465/node
  Yarn:
    version: 1.22.19
    path: /var/folders/s9/k2twkc7n6xjg_rldxb1qtr_9568bbk/T/yarn--1710338064745-0.30628516454972465/yarn
  npm:
    version: 9.6.3
    path: ~/.nvm/versions/node/v19.9.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/gesoubr1/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.5
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/gesoubr1/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Xcode : 15.3

Steps to reproduce

  1. Launch the Example project from this repo on iOS (iOS 17.4, Xcode 15.3)
  2. Click on "Request" below the APP_TRACKING_TRANSPARENCY permissions
    => System permission popup is displayed but Snack shows immediately "blocked" without waiting for the user choice

Reproducible sample code

Code from the Example (App.tsx, l.98) : 
                  
<Button
  icon="help-circle-outline"
  mode="contained"
  onPress={() => {
    RNPermissions.request(item)
      .then((status) => {
        showSnackbar(`request(${name})`, status);
      })
      .catch((error) => {
        console.error(error);
      });
  }}
>
  Request
</Button>
@Geoffrey63 Geoffrey63 added the bug Something isn't working label Mar 13, 2024
@Vepsur
Copy link

Vepsur commented Mar 20, 2024

I was having the same issue, and all that I needed to do was globally turn on tracking in my iPhone settings

@krizzu
Copy link

krizzu commented Mar 27, 2024

Seems like OS issue
https://forums.developer.apple.com/forums/thread/746432

@Rebsos
Copy link

Rebsos commented Apr 12, 2024

It's still not fixed by Apple, so I used while + check in redux-saga:

  let result = yield call(check, PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
  if (result === RESULTS.DENIED) {                                  // The permission has not been requested, so request it.
    /*
      There is a bug in iOS 17.4 request function. It does not wait for the user to make a decision
      and returns immediately "blocked". Usually it should wait and return the decision of the user.
      The check function works correctly. Therefore, we have to loop and check until the user has
      made a decision (denied or granted). Source:
      https://github.com/zoontek/react-native-permissions/issues/857
      https://forums.developer.apple.com/forums/thread/746432
    */
    yield call(request, PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY); // Bug in 17.4. Don't use result, because it is always "blocked"
    while (result === RESULTS.DENIED) {
      yield delay(5000);
      result = yield call(check, PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
    }
  }

@Mihai-github
Copy link

Does anybody experience this behavior but with unavailable? For me on iOS 17.x.x I have this.

@dylancom
Copy link

Should be fixed now in iOS 17.5

@Geoffrey63
Copy link
Author

Should be fixed now in iOS 17.5

Yes, tested on my apps, it has been fixed in iOS 17.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants