-1
こんにちは皆、私は助けが必要です)...私はボタンを3回押すとカウンターで "snapShotButton"ボタンを作りたいと思います。このアプリを使用するために "。私が「OK」を押すと、彼は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()
}
このコードでは何が起こっていませんか? –
何が問題なのですか? –
コードは正しいですか?エラーはありますか? –