-1
大家好,我需要幫助的人)...我想做一個按鈕「snapShotButton」與計數器時,我按下按鈕3次,我想警惕寫「你需要支付爲了使用這個應用程序「。而當我按下「確定」,他將支付與MKStoreKit ...我有MKStoreKit和我的應用程序是視頻編輯器...感謝您的問候!計數器上的按鈕「保存」
func addButtons() {
let snapShotButton = UIButton(type: .system)
snapShotButton.setImage(#imageLiteral(resourceName: "snapShot").withRenderingMode(.alwaysOriginal), for: .normal)
snapShotButton.translatesAutoresizingMaskIntoConstraints = false
bottomTabBar.addSubview(snapShotButton)
snapShotButton.centerYAnchor.constraint(equalTo: bottomTabBar.centerYAnchor).isActive = true
snapShotButton.centerXAnchor.constraint(equalTo: bottomTabBar.centerXAnchor).isActive = true
snapShotButton.heightAnchor.constraint(equalToConstant: 32).isActive = true
snapShotButton.widthAnchor.constraint(equalToConstant: 32).isActive = true
snapShotButton.addTarget(self, action: #selector(snapShotButtonTapped), for: .touchUpInside)
snapShotButton.addTarget(self, action: #selector(counterAction), for: .touchUpInside)
}
func counterAction(sender:UIButton){
counter -= 1
print(counter)
if counter == 0 {
MKStoreKit.shared().initiatePaymentRequestForProduct(withIdentifier: "com.steinlogic.iapdemo.quarterly")
}
}
func snapShotButtonTapped() {
pauseVideo()
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: self.videoURL)
}) { saved, error in
if saved {
DispatchQueue.main.async { _ in
self.dismiss(animated: true, completion: nil)
}
}
else {
self.alertErrors()
}
}
//alertNotAvailable()
}
此代碼沒有出現什麼情況? –
究竟是什麼問題? –
你的代碼對我來說看起來正確嗎?任何錯誤? –