swiftskadnetwork

Implimenting registerAppForAdNetworkAttribution() or updateConversionValue() in swiftui


I have an iOS app that I want to advertise on Reddit and I'm trying to implement registerAppForAdNetworkAttribution() or updateConversionValue() but can't figure out where and how.

For app actions on launch I'm using this method:

class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
} 

I can't extent AppDelegate with SKAdNetwork (error: "Multiple inheritance from classes 'NSObject' and 'SKAdNetwork'")

I couldn't find anywhere, any example for where and how to call registerAppForAdNetworkAttribution() or updateConversionValue()


Solution

  • registerAppForAdNetworkAttribution is a class method on SKAdNetwork: https://developer.apple.com/documentation/storekit/skadnetwork/2943654-registerappforadnetworkattributi

    That means that instead of trying to extend SKAdNetwork like you mentioned in your question, you should instead call it like this:

    SKAdNetwork.registerAppForAdNetworkAttribution()