由于 ATT 请求未出现,Apple 审核人员刚刚拒绝了我的应用程序:“在 iOS 15.0.1 上审核时,我们无法找到应用程序跟踪透明度权限请求。”
我的代码如下所示:
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
//print("IDFA STATUS: \(status.rawValue)")
FBAdSettings.setAdvertiserTrackingEnabled(true)
}
}
我在 AppDelegate 中实现了这段代码didFinishLaunchingWithOptions
and viewDidLoad
。 ATT 权限请求出现在 iOS 14 上,但不在 iOS 15 中。
该死的,我修复了它:( 这都是关于 iOS 警报系统的。在提出通知请求后,我请求应用程序跟踪透明度。一旦通知请求警报关闭,ATT 警报就需要出现。它在 iOS 上运行良好14,但在 iOS 15 上,要在另一个警报之后显示警报,彼此之间需要有一个延迟时间。
编辑:
这是我的代码,分别显示两个警报:
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)
}
}
}
}
}
为了方便起见,这里是我的 NotificaitionHandler 类:
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()
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)