For Swift:
private func trackAppDownload(){
DownloadTracker.sharedManager.logDownload {(success, error) in
var message = ""
if error != nill{
message = error!.localizedDescription
} else {
message = (success as? String) ?? ""
}
NSLog("%@", message)
DispatchQueue.main.async {
let alert = UIAlertController.init(title: "Download Tracker", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction.init(title: "OK", style: .default, handler: {(action) in }))
self.window?.rootViewController?.show(alert, sender: self)
}
}
}