ATTrackingManager.AuthorizationStatus должен быть авторизован, чтобы отложенная глубинная ссылка работала. Подробнее читайте на странице: https://developer.apple.com/documentati ... ansparency
Это не имеет смысла, поскольку статус авторизован
Шаги по воспроизведению
Какие действия необходимы для воспроизведения этой проблемы?
Очень просто описать:
- Войдите в свой аккаунт facebook
- Затем нажмите https://developers.facebook.com/tools/app-ads-helper
- Выберите приложение, которое хотите протестировать, из раскрывающегося списка.
- Нажмите «Отправить».
- Внизу вы найдете «Тестер глубоких ссылок» в разделе «Инструменты разработчика».
- Нажмите «Проверить глубокие ссылки», и в диалоговом окне вы сможете войти. вашу глубокую
ссылку. - Отметьте галочками «Отправить уведомление» и «Отправить отложенно».
- После этого вы получите уведомление в своем приложении Facebook.
- Нажмите на уведомление, и откроется магазин приложений.
- Установите приложение через Xcode.
Затем в своем коде я попробовал все эти варианты:
Я попробовал это:
Код: Выделить всё
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Set the trackings to true in test mode
Settings.setAdvertiserTrackingEnabled(true)
Settings.isAdvertiserIDCollectionEnabled = true
Settings.isAutoLogAppEventsEnabled = true
// Initialize the Facebook SDK
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
Settings.shared.isAdvertiserIDCollectionEnabled = false
Settings.shared.isAdvertiserTrackingEnabled = false
Settings.shared.isAutoLogAppEventsEnabled = false
}
Код: Выделить всё
class SomePrimaryViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
@available(iOS 14.5.1, *)
private func presentTransparencyMode() {
ATTrackingManager.requestTrackingAuthorization { status in
switch status
{
case .authorized:
// Tracking authorization dialog was shown
// and we are authorized
print("Authorized")
// Now that we are authorized we can get the IDFA
print(ASIdentifierManager.shared().advertisingIdentifier)
// Get the Deferred link
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.setupDefferedLink()
}
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")
}
}
}
private func setupDefferedLink() {
// Set the trackings to true in test mode
Settings.shared.isAdvertiserIDCollectionEnabled = true
Settings.shared.isAdvertiserIDCollectionEnabled = true
Settings.shared.isAutoLogAppEventsEnabled = true
let id = ASIdentifierManager.shared().advertisingIdentifier.uuidString
let request = GraphRequest(graphPath: "/971082983006874/activities", parameters: ["event": "DEFERRED_APP_LINK",
"advertiser_id": id,
"application_tracking_enabled": "1",
"advertiser_tracking_enabled": "1"], httpMethod: .post)
request.start { [unowned self] connection, result, error in
if let result = result as? NSDictionary {
print(result as Any)
// It prints a dictionary with a key `success` with value `true`
// and nothing about the url
}
}
AppLinkUtility.initialize()
AppLinkUtility.fetchDeferredAppLink { (url, error) in
if let url = url {
print(url)
}
print(error as Any)
// It prints:
// ATTrackingManager.AuthorizationStatus must be `authorized` for deferred deep linking to work. Read more at: https://developer.apple.com/documentation/apptrackingtransparency
// That is an Error of the SDK, because the permission has been granted
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/756 ... return-nil
Мобильная версия