Solved: Added Flurry Config Observer in Swift
Today, I added FlurryConfig on AppDelegate.swift, and added the Flurry Config Delegate methods on the AppDelegate like below:
Today, I added FlurryConfig on AppDelegate.swift
, and added the Flurry Config Delegate methods on the AppDelegate like below:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
FConfig.sharedInstance().registerObserver(self, executionQueue: DispatchQueue(label: "dispatch_queue_#1", qos: .background))
FConfig.sharedInstance().fetch()
...
}
//MARK: - Flurry Config Delegate
extension AppDelegate {
func fetchComplete() {
print("FConfig: fetchComplete")
}
func fetchCompleteNoChange() {
print("FConfig: fetchCompleteNoChange")
}
func fetchFail() {
print("FConfig: fetchFail")
}
func activationComplete() {
print("FConfig: activationComplete")
}
}
With the above code, the delegate functions were not invoked, and finally, we find that we need add the @objc
to the delegate functions, so the final Flurry Config Delegate functions are like below:
//MARK: - Flurry Config Delegate
extension AppDelegate {
@objc func fetchComplete() {
print("FConfig: fetchComplete")
}
@objc func fetchCompleteNoChange() {
print("FConfig: fetchCompleteNoChange")
}
@objc func fetchFail() {
print("FConfig: fetchFail")
}
@objc func activationComplete() {
print("FConfig: activationComplete")
}
}
With the above changes, the delegate methods can be invoked.