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

ATT Not working on IOS 15.0 #22

Closed
alixumer opened this issue Sep 29, 2021 · 16 comments
Closed

ATT Not working on IOS 15.0 #22

alixumer opened this issue Sep 29, 2021 · 16 comments

Comments

@alixumer
Copy link

We have got a message from app store.

" We're looking forward to completing our review, but we need more information to continue. Your app uses the AppTrackingTransparency framework, but we are unable to locate the App Tracking Transparency permission request when reviewed on iOS 15.0.

Since you indicated in App Store Connect that you collect data in order to track the user, we need to confirm that App Tracking Transparency has been correctly implemented "

Kindly update the plugin as soon as possible.
Thank You

@deniza
Copy link
Owner

deniza commented Sep 29, 2021

I just compiled the example using xcode 13 and tested it on ios 15 simulator. Everything seems running fine. As I do not have any ios devices running ios 15, I cannot test it on a real device right now. Do you have any chance to test the example on an ios 15 device?

@deniza
Copy link
Owner

deniza commented Sep 29, 2021

Oh, and please update the plugin to version 2.0.2+1 to fix a nasty bug regarding to null safety in example.

@alixumer
Copy link
Author

Thank you so much for your response. I have updated the version, now it is working fine. Also i have tested it on a real device with IOS 15.0, it is working.

@jodymac
Copy link

jodymac commented Oct 2, 2021

I just got this as well. However, simply updating the plugin and reloading on ios 15 didn't solve the issue. I had to actually move the location where I called the plugin. I was calling it in an init that only runs after checking if it's first run, where it's always been since I started using it. Now it won't run event though the method is called. I moved it to the end of my onboarding and now it works just fine. So if you run across this and the above doesn't fix it. Try calling the the check at a different time.

I am calling WidgetsFlutterBinding.ensureInitialized(); and MobileAds.instance.initialize(); in my main.dart. It's completely possible that playing with these could have been a solution as well. For some reason, the plugin just wasn't firing like it did before. I also had onesignal firing about the same time, that continued to work the same.

@Eittipat
Copy link

I have this problem too

@Zazell
Copy link

Zazell commented Oct 16, 2021

I'm running in the same problem; What i found is that the plugin isn't prompting for the permission and that it returns a restricted status, upon checking this in the Tracking screen in iOS, it mentions there that the setting cannot be enabled because my Apple ID is missing age information (being 40+ and the birthdate is in my apple ID, this sounds like an issue with iOS to me...)

No real solution found yet, except logging out of my apple ID and then it works...

@yacineblr
Copy link

Same problem on my side, a solution has been found?

@ipapps
Copy link

ipapps commented Oct 22, 2021

Seems that, starting with iOS 15, there is a problem prompting two consecutive native popups. Especially, if you prompt at around the same time (at startup probably), the notification authorization prompt, then your ATT prompt will be squashed.

On a project of mine (a native iOS one), I had to do this to overcome this problem :

    func applicationDidBecomeActive(_ application: UIApplication) {
        if #available(iOS 14, *) {
            ATTrackingManager.requestTrackingAuthorization { status in
                switch status {
                case .authorized:
                    Settings.setAdvertiserTrackingEnabled(true)
                case .denied:
                    Settings.setAdvertiserTrackingEnabled(false)
                case .notDetermined: break
                case .restricted:
                    Settings.setAdvertiserTrackingEnabled(false)
                @unknown default: break
                }
            }
        }
    }

Moving the ATTrackingManager to applicationDidBecomeActive instead of the more common application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?)

@yacineblr
Copy link

Thanks for your reply @ipapps ,
That's exactly what I just did in addition to using the package to retrieve the user id.
I sent back the app for apple submission, I just have to wait

@Emicloud91
Copy link

Emicloud91 commented Oct 24, 2021

Hi everyone,
any solution on this issue?

@walvespit
Copy link

anyone? same problem here

@jodymac
Copy link

jodymac commented Nov 2, 2021

Please read all the posts on this, there are two solutions identified earlier. ipapps identification of the issue seems to be correct. My post above tells what I did to solve. In a nutshell, with ios 15, don't have back to back notifications fire consecutively.

@deniza
Copy link
Owner

deniza commented Nov 2, 2021

You can also use a custom explainer dialog before calling AppTrackingTransparency.requestTrackingAuthorization(); ​
I guess this prevents consecutive popping dialogue problem @ipapps mentions.

Using this approach is also recommended by Google.

@yacineblr
Copy link

@walvespit Requesting authorization in the AppDelegate solved the problem, the verification is passed, and the app is available on the store

@walvespit
Copy link

@walvespit Requesting authorization in the AppDelegate solved the problem, the verification is passed, and the app is available on the store

Thank you for your answer, can you explain a little more please ? Where exactly is "in the AppDelegate" ?

@yacineblr
Copy link

yacineblr commented Nov 3, 2021

in the file ios/Runner/AppDelegate.swift, I put this function in my class "AppDelegate" like this:

/// your import
import AppTrackingTransparency // add this

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    /// your code here
  }

  override func applicationDidBecomeActive(_ application: UIApplication) { // add this function
    if #available(iOS 14, *) {
      ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
          switch status {
          case .authorized:
              // Tracking authorization dialog was shown
              // and we are authorized
              print("Authorized")
          case .denied:
              // Tracking authorization dialog was
              // shown and permission is denied
              print("Denied")
          case .notDetermined:
              // Tracking authorization dialog has not been shown
              print("Not Determined")
          case .restricted:
              print("Restricted")
          @unknown default:
              print("Unknown")
          }
      })
    } else {
        //you got permission to track, iOS 14 is not yet installed
    }
  }
}

The tracking permission request will be the first to be displayed, then in flutter with the "app_tracking_transparency" package I check if the permission has been granted, if so, I get the identifier.

This is not the best method, but it allowed to pass the Apple verification

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

9 participants