Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks done
dackArrogant opened this issue Nov 4, 2024 · 0 comments

Comments

@dackArrogant
Copy link

Checklist before submitting a bug report

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

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) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant