Expand my Community achievements bar.

SOLVED

type 'AEPMobileCore' has no member 'trackAction' error while migrating from ACPCore to AEPCore

Avatar

Level 1

Hello,

We have upgraded our Capacitor to version 6 and I was getting error  "Adobe" plugin is not implemented. so I am trying to migrate ACPCore imports to AEPCore in our AdobePlugin.swift file for push notifications. Not sure if it will resolve the error.

I am getting this error while migrating:

AdobePlugin.swift:63:27: error: type 'AEPMobileCore' has no member 'trackAction'
AEPMobileCore.trackAction("tracking", data: piiContextData);

Can someone please help me to figure out what I am missing?
Following is a part of the file which is throwing errors for trackAction. 

 

import Foundation
import Capacitor
import AEPCore
import AEPLifecycle
import AEPIdentity
import AEPSignal
import UserNotifications

@objc(AdobePlugin)
public class AdobePlugin: CAPPlugin {
  @objc(trackAction:data:)
  public static func track(action: String?, data: [String: Any]?) {
    let deliveryId = data["deliveryId"] as? String ?? ""
    let broadlogId = data["broadlogId"] as? String ?? ""

      if (deliveryId == "" || broadlogId == "") {
      print("trackAction failure")
      return
    } else {
      let piiContextData: [String: String] = [
      "deliveryId": deliveryId,
      "broadlogId": broadlogId,
      "action": action] //1-open 2-click, 7-impression.
      AEPMobileCore.trackAction("tracking", data: piiContextData);

      print(["trackAction result": "success"])
    }
  }
}

// old code
import Foundation
import Capacitor
import ACPCore
import UserNotifications

@objc(AdobePlugin)
public class AdobePlugin: CAPPlugin {
    @objc func trackAction(_ call: CAPPluginCall) {
        let action = call.getString("action") ?? "";
        let deliveryId = call.getString("deliveryId") ?? "";
        let broadlogId = call.getString("broadlogId") ?? "";

        if (deliveryId == "" || broadlogId == "") {
            call.reject("trackAction failure")
            
        } else {
            let piiContextData: [String: String] = [
            "deliveryId": deliveryId,
            "broadlogId": broadlogId,
            "action": action] //1-open 2-click, 7-impression.
            ACPCore.trackAction("tracking", data: piiContextData);

            call.resolve(["trackAction result": "success"])
        }
    }
}

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @arpita_p  I would suggest you to look at this test app code using the same AEPCore import: https://github.com/adobe/aepsdk-core-ios/blob/main/TestApps/TestApp_Swift/AppDelegate.swift


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @arpita_p  I would suggest you to look at this test app code using the same AEPCore import: https://github.com/adobe/aepsdk-core-ios/blob/main/TestApps/TestApp_Swift/AppDelegate.swift


     Manoj
     Find me on LinkedIn

Avatar

Level 1

Hi @_Manoj_Kumar_ 
Thank you for the quick response. I was able to pass the ios build and from the file you have shared, things looks good on my swift file but I am still getting error when I allow notifications in my phone. Now it says "Error: "Adobe" plugin is not implemented on ios"