Hi Everyone, We are not receiving any facebook ev...
# support
m
Hi Everyone, We are not receiving any facebook events for rudderstack iOS v2 SDK. We have also setup ATT for this but its not working, sharing the code
AppDelgate
-
Copy code
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

            
    //Rudderstack
    let config: RSConfig = RSConfig(writeKey: AppConfiguration.rudderStackId)
      .dataPlaneURL(AppConfiguration.dataPlaneUrl)
             .recordScreenViews(false)
             .sleepTimeOut(10)
             .trackLifecycleEvents(true)
         
    let _: () = RSClient.sharedInstance().configure(with: config)
    RSClient.sharedInstance().addDestination(RudderFirebaseDestination())
    RSClient.sharedInstance().addDestination(RudderFacebookAppEventsDestination())

    //-------
    return true
  }
SceneDelegate
-
Copy code
func sceneDidBecomeActive(_ scene: UIScene) {
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
      self.requestPermission()
    }
  }
  func requestPermission() {
    if #available(iOS 15.0, *) {
      ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
        switch status {
        case .authorized:
          print("Authorized")
          Settings.shared.isAutoLogAppEventsEnabled = true;
          Settings.shared.isAdvertiserTrackingEnabled = true;
          Settings.shared.isAdvertiserIDCollectionEnabled = true;
           
        case .denied:
          Settings.shared.isAutoLogAppEventsEnabled = false
          Settings.shared.isAdvertiserTrackingEnabled = false
          Settings.shared.isAdvertiserIDCollectionEnabled = false
          print("Denied")
        case .notDetermined:
          print("Not Determined")
        case .restricted:
          print("Restricted ")
        @unknown default:
          print("Restricted ")
        }
      })
    }
m
Hey There! 👋 Your message has been received by the RudderStack team. Our standard customer support hours are 9-6 PM EST, but we will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
Hi Onkar can you provide the destination Id? Also are you using self-hosted? If you are using self-hosted can you provide the email_id and workspace Id other than the destination ID? Also can you share any error logs that you are seeing?
m
@ambitious-breakfast-83504 Can u pls share the details here
a
Hi @shy-kite-21035 destinationId : 2WlvRvGrKgoQf7wDRC9JgjtWevp yes we are using self hosted dataplane WorkspaceId : 27KDIgJP2hFZdErXvJBXV8l59DE Workspace name : rentomojo-subramony.m we are not seeing any log errors
m
@shy-kite-21035 Any update?
m
Will check with the team
c
Hey @miniature-student-15871, Will it be possible for you to switch to the iOS-v1 SDK? As iOS-v2 is still in beta and this Facebook swift integration is quite outdated. Also, have you followed this Facebook doc: https://developers.facebook.com/docs/app-events/getting-started-app-events-ios: • You need to first configure your project at the Facebook dashboard. • Add this keys in your
info.plist
file:
Copy code
<array>
      <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fbAPPID</string>
      </array>
      </dict>
    </array>
    <key>FacebookAppID</key>
    <string>APPID</string>
    <key>FacebookClientToken</key>
    <string>FacebookClientToken</string>
    <key>FacebookDisplayName</key>
    <string>DISPLAYNAME</string>
    <key>NSUserTrackingUsageDescription</key>
    <string>Select allow to send event to Facebook App Events</string>
• Please call this method before intialising the Rudder iOS SDK: (Swift code)
Copy code
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
• Also can you ensure that you’re able to provide the ATT consent before Rudder SDK gets initialised? You may optionally refer to this iOS-v2 based Facebook codes to understand the setup: Swift and Objective-C. For iOS-v1, refer to this Objective-C code.