@@ -342,7 +342,13 @@ final class ViewController: UIViewController, UITextFieldDelegate {
342
342
providerListLabel. text = providers? . joined ( separator: " , " )
343
343
if let photoURL = user? . photoURL {
344
344
lastPhotoURL = photoURL
345
- DispatchQueue . global ( priority: DispatchQueue . GlobalQueuePriority. background) . async {
345
+ let queue : DispatchQueue
346
+ if #available( iOS 8 . 0 , * ) {
347
+ queue = DispatchQueue . global ( qos: . background)
348
+ } else {
349
+ queue = DispatchQueue . global ( priority: DispatchQueue . GlobalQueuePriority. background)
350
+ }
351
+ queue. async {
346
352
if let imageData = try ? Data ( contentsOf: photoURL) {
347
353
let image = UIImage ( data: imageData)
348
354
DispatchQueue . main. async {
@@ -382,8 +388,22 @@ final class ViewController: UIViewController, UITextFieldDelegate {
382
388
}
383
389
384
390
fileprivate func showAlert( title: String , message: String ? = " " ) {
385
- UIAlertView ( title: title, message: message ?? " (NULL) " , delegate: nil , cancelButtonTitle: nil ,
386
- otherButtonTitles: " OK " ) . show ( )
391
+ if #available( iOS 8 . 0 , * ) {
392
+ let alertController =
393
+ UIAlertController ( title: title, message: message, preferredStyle: . alert)
394
+ alertController. addAction ( UIAlertAction ( title: " OK " ,
395
+ style: . default,
396
+ handler: { ( UIAlertAction) in
397
+ alertController. dismiss ( animated: true , completion: nil )
398
+ } ) )
399
+ self . present ( alertController, animated: true , completion: nil )
400
+ } else {
401
+ UIAlertView ( title: title,
402
+ message: message ?? " (NULL) " ,
403
+ delegate: nil ,
404
+ cancelButtonTitle: nil ,
405
+ otherButtonTitles: " OK " ) . show ( )
406
+ }
387
407
}
388
408
389
409
private func ifNoError( _ error: Error ? , execute: ( ) -> Void ) {
0 commit comments