facebook / facebook/facebook-ios-sdk

starting with Graph API v2.4, GET requests for /model_asset should contain an explicit "fields" parameter

Open
#2,496 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Swift
Stars
8.1k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

### Checklist before submitting a bug report

- [X] 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.3

### Facebook iOS SDK version

17.4.0

### Dependency Manager

CocoaPods

### SDK Framework

Core

### Goals

Call AppLinkUtility.fetchDeferredAppLink {[weak self] (url, error) in
if let error = error {
print("Error fetching deep link: \(error.localizedDescription)")
return
}
if let url = url {
let deepLinkUrl = url.absoluteString
print("Deferred deep link obtained: \(deepLinkUrl)")
// Handle deep link
_ = self?.handleIncomingURL(url)
} else {
print("Deep link not obtained")
}
} Warning starting with Graph API v2.4, GET requests for /model_asset should contain an explicit "fields" parameter

### Expected results

starting with Graph API v2.4, GET requests for /model_asset should contain an explicit "fields" parameter
AppLinkUtility.fetchDeferredAppLink {[weak self] (url, error) in
if let error = error {
print("Error fetching deep link: \(error.localizedDescription)")
return
}
if let url = url {
let deepLinkUrl = url.absoluteString
print("获取到的延迟深度链接:\(deepLinkUrl)")
// 处理深度链接
_ = self?.handleIncomingURL(url)
} else {
print("未获取到深度链接")
}
}

### Actual results

starting with Graph API v2.4, GET requests for /model_asset should contain an explicit "fields" parameter

### Steps to reproduce

starting with Graph API v2.4, GET requests for /model_asset should contain an explicit "fields" parameter

### Code samples & details

```swift
import UIKit
import FBSDKCoreKit
import AppTrackingTransparency
import AdSupport

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

// 在ios15要在这里调用,需要加点延迟
DispatchQueue.main.asyncAfter(deadline: .now() + 3) { [self] in
let applicationState = UIApplication.shared.applicationState
if applicationState == .active {
requestTrackingAuthorizationAndFetchDeepLink(application, didFinishLaunchingWithOptions: launchOptions)
}
}

reachabilityStartNotifier()
return true
}

private func requestTrackingAuthorizationAndFetchDeepLink(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
if #available(iOS 14.0, *) {
ATTrackingManager.requestTrackingAuthorization { status in
if status == .authorized {
self.fetchDeepLink()

let advertisingIdentifier = ASIdentifierManager.shared().advertisingIdentifier
if advertisingIdentifier != .init(uuidString: "00000000-0000-0000-0000-000000000000")! {
print("广告标识: \(advertisingIdentifier)")
} else {
print("广告标识不可用")
}
} else {
print("Tracking authorization not granted. Deferred deep linking may not work.")
}
}
} else {
fetchDeepLink()
}
}

private func fetchDeepLink() {
Settings.shared.isAdvertiserIDCollectionEnabled = true
Settings.shared.isSKAdNetworkReportEnabled = true
ApplicationDelegate.shared.initializeSDK()
AppLinkUtility.fetchDeferredAppLink {[weak self] (url, error) in
if let error = error {
print("Error fetching deep link: \(error.localizedDescription)")
return
}
if let url = url {
let deepLinkUrl = url.absoluteString
print("获取到的延迟深度链接:\(deepLinkUrl)")
// 处理深度链接
_ = self?.handleIncomingURL(url)
} else {
print("未获取到深度链接")
}
}
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// 处理传入的URL
return handleIncomingURL(url)
}

func handleIncomingURL(_ url: URL) -> Bool {
// 解析URL并根据需要执行操作
print("处理传入的URL: \(url.absoluteString)")

// 示例:根据URL路径或参数进行不同的处理
if let components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
// 解析路径或查询参数
if components.path == "/somePath" {
// 处理特定路径
print("处理特定路径: \(components.path)")
// 在这里导航到对应的视图控制器
return true
}
}

return false
}
}

extension AppDelegate {
private func reachabilityStartNotifier() {
let reach = Reachability()!
NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged(note:)), name: .reachabilityChanged, object: reach)
do {
try reach.startNotifier()
} catch {}
}

@objc public func reachabilityChanged(note _: Notification) {}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.