Commit 3e8d7654 authored by pete谢兆麟's avatar pete谢兆麟

解决拒绝权限崩溃的问题

parent a42e8280
...@@ -161,10 +161,12 @@ extension YHInvatationShareViewController { ...@@ -161,10 +161,12 @@ extension YHInvatationShareViewController {
YHHUD.flash(message: "保存成功") YHHUD.flash(message: "保存成功")
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func wxClick() { @objc func wxClick() {
// guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return } // guard let combinedImage = combinedImageFrom(imageView: centerImageView) else { return }
......
...@@ -195,10 +195,12 @@ class YHConsultantQRCodeView: UIView { ...@@ -195,10 +195,12 @@ class YHConsultantQRCodeView: UIView {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil) UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) { @objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
if didFinishSavingWithError != nil { if didFinishSavingWithError != nil {
......
...@@ -101,12 +101,16 @@ private extension YHVisaPayTypeCell { ...@@ -101,12 +101,16 @@ private extension YHVisaPayTypeCell {
PHPhotoLibrary.requestAuthorization { status in PHPhotoLibrary.requestAuthorization { status in
if status == .authorized { if status == .authorized {
// 保存UIImage对象到相册 // 保存UIImage对象到相册
DispatchQueue.main.async {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil) UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(_:didFinishSavingWithError:contextInfo:)), nil)
}
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeMutableRawPointer?) { @objc func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeMutableRawPointer?) {
// 保存完成后的处理逻辑 // 保存完成后的处理逻辑
......
...@@ -237,10 +237,12 @@ extension YHFileListViewController { ...@@ -237,10 +237,12 @@ extension YHFileListViewController {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil) UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) { @objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
......
...@@ -493,10 +493,12 @@ extension YHMyFileListViewController { ...@@ -493,10 +493,12 @@ extension YHMyFileListViewController {
UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil) UIImageWriteToSavedPhotosAlbum(image, self, #selector(self.image(image:didFinishSavingWithError:contextInfo:)), nil)
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) { @objc func image(image: UIImage,didFinishSavingWithError: NSError?,contextInfo: AnyObject) {
if didFinishSavingWithError != nil { if didFinishSavingWithError != nil {
......
...@@ -152,10 +152,12 @@ extension YHResignGuidelinesExampleShareViewController { ...@@ -152,10 +152,12 @@ extension YHResignGuidelinesExampleShareViewController {
YHHUD.flash(message: "保存成功") YHHUD.flash(message: "保存成功")
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
@objc func wxClick() { @objc func wxClick() {
YHShareManager.shared.sendLinkContent("香港身份测评专属方案,限时领取!", "银河身份规划专家1V1评估,获取香港身份方案", UIImage(named: "resign_guidelines_example_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30") YHShareManager.shared.sendLinkContent("香港身份测评专属方案,限时领取!", "银河身份规划专家1V1评估,获取香港身份方案", UIImage(named: "resign_guidelines_example_share_other") ?? UIImage(), link: YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/evaluation?channel=lkhtj-app&customer_id=\(YHLoginManager.shared.userModel?.id ?? "")&scene_id=30")
......
...@@ -412,10 +412,12 @@ extension YHH5WebViewVC { ...@@ -412,10 +412,12 @@ extension YHH5WebViewVC {
YHHUD.flash(message: "保存成功") YHHUD.flash(message: "保存成功")
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
} }
//MARK: - UIScrollViewDelegate //MARK: - UIScrollViewDelegate
......
...@@ -259,8 +259,10 @@ private extension YHLongtapPictureSheetView { ...@@ -259,8 +259,10 @@ private extension YHLongtapPictureSheetView {
YHHUD.flash(message: "保存成功") YHHUD.flash(message: "保存成功")
} }
} else { } else {
DispatchQueue.main.async {
YHHUD.flash(message: "保存失败,请检查系统权限") YHHUD.flash(message: "保存失败,请检查系统权限")
} }
} }
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment