ATTrackingManager.AuthorizationStatus muss autorisiert sein, damit verzögerte Deep-Links funktionieren. Lesen Sie mehr unter: https://developer.apple.com/documentati ... ansparency
Es macht keinen Sinn, weil der Status autorisiert ist
Schritte zum Reproduzieren
Welche Schritte sind notwendig, um dieses Problem zu reproduzieren?
Sehr einfach zu beschreiben:
- Melden Sie sich bei Ihrem an facebook
- Klicken Sie dann auf https://developers.facebook.com/tools/app-ads-helper
- Wählen Sie im Dropdown-Menü eine App aus, die Sie testen möchten
- Klicken Sie auf „Senden“
- Unten finden Sie „Deep Link Tester“ unter „Entwicklertools“.
- Klicken Sie auf „Deep Link testen“ und im Dialog können Sie Ihren Deeplink eingeben.
Link. - Aktivieren Sie die Kontrollkästchen „Benachrichtigung senden“ und „Verzögert senden“.
- Dann erhalten Sie eine Benachrichtigung an Ihre Facebook-App.
- Tippen Sie auf die Benachrichtigung und der App Store wird geöffnet
- Installieren Sie die App über Xcode
Dann in In meinem Code habe ich alle diese Varianten ausprobiert:
Ich habe Folgendes versucht:
Code: Select all
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
}
Code: Select all
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
}
}
}
Mobile version