I am trying to add facebook app events, and I installed FacebookSDK. Then I have next code:
import FacebookCore
static func logViewContentEvent(contentType : String, contentData : String, contentId : String, currency : String, price : Double) {
let params : AppEvent.ParametersDictionary = [
.contentType : contentType,
.content : contentData,
.contentId : contentId,
.currency : currency
]
let event = AppEvent(name: .viewedContent, parameters: params, valueToSum: price)
AppEventsLogger.log(event)
}
But I get error from the title. What I am doing wrong, and why this type is missing?
It's a knowed facebook annoying issue.
Before FBSDK 5.0.1 your code works well. After, you can change your code with for example:
static func logViewContentEvent(contentType : String, contentData : String, contentId : String, currency : String, price : Double) {
let params = [
"contentType": contentType,
"content" : contentData,
"contentID" : contentId,
"currency" : currency
]
AppEvents.logEvent(AppEvents.Name(rawValue: "viewedContent"), valueToSum: price, parameters: params)
}