App Tracking Transparency Dialog does not appear on iOS
Damn it I fixed it:( This is all about the iOS alert system. I was requesting App Tracking Transparency after a notification request was asked. Once the notification request alert closed, the ATT alert needed to have appeared. It was working fine on iOS 14, but on iOS 15 to display an alert right after another one, it is needed to have a delay period between each other.
Edit:
Here is my code that display two alert respectively:
func setNotification(){
//Ask for notification permission
let n = NotificationHandler()
n.askNotificationPermission {
//n.scheduleAllNotifications()
//IMPORTANT: wait for 1 second to display another alert
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
//print("IDFA STATUS: \(status.rawValue)")
//FBAdSettings.setAdvertiserTrackingEnabled(true)
}
}
}
}
}
And for your convenience here is my NotificaitionHandler class:
import UserNotifications
class NotificationHandler{
//Permission function
func askNotificationPermission(completion: @escaping ()->Void){
//Permission to send notifications
let center = UNUserNotificationCenter.current()
// Request permission to display alerts and play sounds.
center.requestAuthorization(options: [.alert, .badge, .sound])
{ (granted, error) in
// Enable or disable features based on authorization.
completion()
}
}
App Tracking Transparency popup do not appear
I found how to do this.
Add in your first ViewController
import AppTrackingTransparency
import AdSupport
import UserNotifications
Add in viewdidload
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
print("IDFA STATUS: \(status.rawValue)")
}
}
}
App Tracking Transparency on Flutter was rejected by Apple
The same thing exactly happened with me twice and in both time the issue was resolved by simply sending them a video recording of the app showing the Yes/No App Tracking Transparency dialog. They just want to know when it appears to user if you implemented everything correctly. So try sending them a video recording in the resolution center as a response to that message.
Problem with the apple AppTrackingTransparency in expo
After finding this answer, where Apple's documentation says that it should be placed in the applicationDidBecomeActive, it seems like the issue is that the app isn't active.
My fix was to add a timeout around the request to wait until the application is loaded:
setTimeout(async () => {
const { granted } = await requestTrackingPermissionsAsync();
}, 500);
Another option is to add an event listener and see when the application is active through Expo App State and call it then.
ATT Dialog don't show
Solution: I moved the request function into initial view controller
Related Topics
How to Use the Appropriate Color Class For the Current Platform
Mathematical Functions in Swift
A Swift Protocol Requirement That Can Only Be Satisfied by Using a Final Class
How to Restrict Certain Characters in Uitextfield in Swift
Function Does Not Wait Until the Data Is Downloaded
How to Create an Importable Module in Swift
How to Create a PDF in Swift with Cocoa (Mac)
Pass Variables from One Viewcontroller to Another in Swift
Cllocationcoordinate2D Can't Be Instantiated
How to Set the Blurradius of Uiblureffectstyle.Light
What's the Difference Between Aranchor and Anchorentity
Expected to Decode Array<Any> But Found a Dictionary Instead
How to Use Generic Types to Get Object with Same Type