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

Viewed 623

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

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

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.

Related