Instance member 'logEvent' cannot be used on type 'AppEvents'; did you mean to use a value of this type instead?

1.6k Views Asked by At

I have used Facebook AppEvents in which I am getting error:-

AppEvents.logEvent(.completedRegistration, parameters: [AppEvents.ParameterName.registrationMethod.rawValue: "customerId"])
1

There are 1 best solutions below

0
Vikrant Bhatia On

AppEvents class from Facebook is now singleton class, so to use the methods of AppEvents class you have to add shared between class and method name so solution for this is use:

Instead of using AppEvents.logEvent use AppEvents.shared.logEvent.

AppEvents.shared.logEvent(.completedRegistration, parameters: [AppEvents.ParameterName.registrationMethod.rawValue: "customerId"])

Also, please remove .rawValue to avoid error Cannot convert '[String : Any]' to expected argument type '[AppEvents.ParameterName : Any]'.

You can check this answer.