From 3bb9ef528199cab12e5f9b3bbf1064cfa296caaa Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期五, 22 十二月 2023 11:03:52 +0800
Subject: [PATCH] 修复BUG: 1. 相机授权“取消”崩溃问题 2. 活动列表未带城市问题

---
 WanPai/Common/VC/CommonScanQRCodeVC.swift |   48 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/WanPai/Common/VC/CommonScanQRCodeVC.swift b/WanPai/Common/VC/CommonScanQRCodeVC.swift
index 7771867..6474106 100644
--- a/WanPai/Common/VC/CommonScanQRCodeVC.swift
+++ b/WanPai/Common/VC/CommonScanQRCodeVC.swift
@@ -148,25 +148,39 @@
 	}
 
 	private func limitFaild(){
-		let alertController = UIAlertController(title: nil,message: "请在iphone的“设置-隐私-相机”选项中,允许应用访问你的相机", preferredStyle: .alert)
-		let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: { action in
-			self.navigationController?.popViewController(animated: true)
-		})
-
-		let okAction = UIAlertAction(title: "前往", style: .default, handler: {action in
-			let settingUrl = NSURL(string: UIApplication.openSettingsURLString)!
-			if UIApplication.shared.canOpenURL(settingUrl as URL){
-				if #available(iOS 10.0, *) {
-					UIApplication.shared.open(settingUrl as URL, options: [:], completionHandler: nil)
-				} else {
-					UIApplication.shared.openURL(settingUrl as URL)
+		DispatchQueue.main.async {
+			let alertController = UIAlertController(title: nil,message: "请在iphone的“设置-隐私-相机”选项中,允许应用访问你的相机", preferredStyle: .alert)
+			let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: { action in
+				if self.qmui_isPresented(){
+					self.dismiss(animated: true)
+				}else{
+					self.navigationController?.popViewController(animated: true)
 				}
-			}
-		})
+			})
 
-		alertController.addAction(cancelAction)
-		alertController.addAction(okAction)
-		self.present(alertController, animated: true, completion: nil)
+			let okAction = UIAlertAction(title: "前往", style: .default, handler: {action in
+
+				if self.qmui_isPresented(){
+					self.dismiss(animated: true)
+				}else{
+					self.navigationController?.popViewController(animated: true)
+				}
+
+
+				let settingUrl = NSURL(string: UIApplication.openSettingsURLString)!
+				if UIApplication.shared.canOpenURL(settingUrl as URL){
+					if #available(iOS 10.0, *) {
+						UIApplication.shared.open(settingUrl as URL, options: [:], completionHandler: nil)
+					} else {
+						UIApplication.shared.openURL(settingUrl as URL)
+					}
+				}
+			})
+
+			alertController.addAction(cancelAction)
+			alertController.addAction(okAction)
+			self.present(alertController, animated: true, completion: nil)
+		}
 	}
 
 	func checkCameraAuth() -> Bool {

--
Gitblit v1.7.1