//=== 系统自带的分享: (底部弹窗分享)【不用接SDK】
static func yeShare(eVCMain:UIViewController){
let eImgIcon = UIImage(named: "ImgBaidu.png")!
let eStrText = "分享的文字内容"
let eUrl = URL(string: "https://www.baidu.com/")!
let eArr = [eImgIcon, eStrText, eUrl] as [Any]
let eVCActivity = UIActivityViewController(activityItems: eArr, applicationActivities: nil)
eVCActivity.completionWithItemsHandler = {(eActivityType:UIActivity.ActivityType?, eCompleted:Bool, eArrReturned:[Any]?, eError:Error?) -> Void in
if nil != eError{
print("分享 出错:\(String(describing: eError))")
} else if(nil == eActivityType || false == eCompleted){
print("分享 取消")
}else{
print("分享 完成")
}
}
eVCMain.present(eVCActivity, animated: true) //推出页面;
}
//=== 评分: 【系统自动的评分页面】
static func yeReviewApp(eStrAppID:String = "id1063100471"){
if let eScene = UIApplication.shared.connectedScenes.first as? UIWindowScene{
if #available(iOS 14.0, *){ // 系统>14.0,新的API评分面板;
/// import StoreKit
SKStoreReviewController.requestReview(in: eScene)
}else{
/// 打开 App在应用商店中的页面,可在该页面进行评分;
let eStrUrl = "itms-apps://itunes.apple.com/app/\(eStrAppID)?action=write-review"
UIApplication.shared.open(URL(string: eStrUrl)!, options: [:], completionHandler: nil)
}
}
}