facebook / facebook/facebook-ios-sdk
[iOS] `AppLinkUtility.fetchDeferredAppLink` returns nil url in completion
- Dominant language
- Swift
- Stars
- 8.1k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist before submitting a bug report
- [ ] I've updated to the latest released version of the SDK
- [X] I've searched for existing [GitHub issues](https://github.com/facebook/facebook-ios-sdk/issues)
- [X] I've looked for existing answers on [Stack Overflow](https://facebook.stackoverflow.com), the [Facebook Developer Community Forum](https://developers.facebook.com/community/) and the [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers)
- [X] I've read the [Code of Conduct](https://github.com/facebook/facebook-ios-sdk/blob/main/CODE_OF_CONDUCT.md)
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
### Xcode version
15.2
### Facebook iOS SDK version
main branch
### Dependency Manager
Building from Source
### SDK Framework
Core
### Goals
I'm trying to retrieve deferred deep link
### Expected results
When calling `AppLinkUtility.fetchDeferredDeepLink` after a deferred deeplink has been sent using the [App Ads Helper](https://developers.facebook.com/tools/app-ads-helper/?id=1043792656902611) tool, I expect the `url` in the completion block to not be nil and should match the deeplink I sent.
### Actual results
The `url` in the completion was nil. This was the network call the SDK made ("1043792656902611/activities" via the Graph API) when fetching the deferred deeplink:
```
POST https://ep1.facebook.com/v17.0/1043792656902611/activities
iOS 17.1.2
# Request
{
"advertiser_id": "9ABB1466-XXXX-XXXX-XXXX-XXXXXXXXXX",
"advertiser_id_collection_enabled": 1,
"advertiser_tracking_enabled": 1,
"anon_id": "XZ7E0AB6C1-XXXX-XXXX-XXXX-XXXXXXXXXX",
"application_tracking_enabled": 1,
"event": "DEFERRED_APP_LINK",
"extinfo": ...
}
# Response
{
"success": 1
}
```
### Steps to reproduce
```swift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
override func applicationDidBecomeActive(_ application: UIApplication) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { [weak self] status in
switch status {
case .authorized:
Settings.shared.isAdvertiserTrackingEnabled = true
Settings.shared.isAdvertiserIDCollectionEnabled = true
self?.fetchDeferredAppLink()
default:
Settings.shared.isAdvertiserTrackingEnabled = false
Settings.shared.isAdvertiserIDCollectionEnabled = false
}
}
} else {
Settings.shared.isAdvertiserTrackingEnabled = true
Settings.shared.isAdvertiserIDCollectionEnabled = true
self.fetchDeferredAppLink()
}
return super.applicationDidBecomeActive(application)
}
func fetchDeferredAppLink() {
let idfa = ASIdentifierManager.shared().advertisingIdentifier
print("IDFA: \(idfa)")
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: {
AppLinkUtility.fetchDeferredAppLink { [weak self] uri, err in
if let err = err {
print("FBSDK_Custom (error): \(err)") // <-- nil
}
if let uri = uri {
print("FBSDK_Custom (uri): \(uri)") // <-- nil
}
}
})
}
}
```
1. Uninstall app
2. Send deferred deeplink via [App Ads Helper](https://developers.facebook.com/tools/app-ads-helper/?id=1043792656902611).
3. Install app
4. Launch app
### Code samples & details
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.