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

[Bug]: iOS appTrackingTransparency.request() always returns PermissionStatus.permanentlyDenied #1421

Open
3 of 5 tasks
equescodebelike opened this issue Dec 17, 2024 · 2 comments

Comments

@equescodebelike
Copy link

equescodebelike commented Dec 17, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Steps to reproduce

Here is my code:
info.plist

<key>NSUserTrackingUsageDescription</key>
<string>Here is some info</string>

main.dart

if (!kIsWeb && Platform.isIOS) {
      var status = await Permission.appTrackingTransparency.status;
      while (status == PermissionStatus.denied) {
        status = await Permission.appTrackingTransparency.request();
        await Future.delayed(const Duration(milliseconds: 200));
      }
    }

Expected results

iOS dialog window with text from NSUserTrackingUsageDescription tag

Actual results

appTrackingTransparency.request() always returns PermissionStatus.permanentlyDenied

Code sample

Code sample
if (!kIsWeb && Platform.isIOS) {
      var status = await Permission.appTrackingTransparency.status;
      while (status == PermissionStatus.denied) {
        status = await Permission.appTrackingTransparency.request();
        await Future.delayed(const Duration(milliseconds: 200));
      }
    }

Screenshots or video

No response

Version

11.3.1

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.24.4, on macOS 14.4 23E214 darwin-x64, locale ru-RU)
    • Flutter version 3.24.4 on channel stable at /usr/local/Caskroom/flutter/3.19.5/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (8 weeks ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/fittin/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] Connected device (2 available)
    • iPhone Arkhip (mobile) • 00008030-0003445E1EEA402E • ios        • iOS 17.1.2 21B101
    • macOS (desktop)        • macos                     • darwin-x64 • macOS 14.4 23E214 darwin-x64
    ! Error: Browsing on the local area network for iPhone (Евгений). Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
@equescodebelike
Copy link
Author

I know about app_tracking_transparency: ^2.0.6 lib, but it looks like cheesy thing, to avoid that permission in handler. And an interesting question about other issues with PermissionStatus.permanentlyDenied return result. Do they have something in common?

@equescodebelike
Copy link
Author

AppDelegate.swift

      guard #available(iOS 14.5, *) else { return }
      
      ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
          print("User granted permission: \(status)")
      })
  }

Also native realization helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant