Adding App Events in iOS app produces undeclared identifier 'AppEvent'

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)
    }

In top of file get rid of FacebookCore use only

         import FBSDKCoreKit
         // implemented  FBSDKCoreKit (5.8.0)
         let event =  "custom event"
         AppEvents.logEvent(AppEvents.Name.init(rawValue: event))

or with parameters

    let a:[String: String] = ["key": "value"]
    AppEvents.logEvent(AppEvents.Name.init(rawValue: event), parameters: a )