bizz84 / SwiftyStoreKit

Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺
MIT License
6.57k stars 796 forks source link

Unknown error. Please contact support #677

Open hzlzh opened 2 years ago

hzlzh commented 2 years ago

Bug Report

"Unknown error. Please contact support" Anyone solve this?

func purchasePro1() {
        SwiftyStoreKit.purchaseProduct(pro1ID, quantity: 1, atomically: true) { result in
            switch result {
            case .success(let purchase):
                print("Purchase Success: \(purchase.productId)")
                isPro1Purchased = true
                self.delegate?.purchaseSucceed()
            case .error(let error):
                var errorString = ""
                switch error.code {
                case .unknown: errorString = "Unknown error. Please contact support"
                case .clientInvalid: errorString = "Not allowed to make the payment"
                case .paymentCancelled: break
                case .paymentInvalid: errorString = "The purchase identifier was invalid"
                case .paymentNotAllowed: errorString = "The device is not allowed to make the payment"
                case .storeProductNotAvailable: errorString = "The product is not available in the current storefront"
                case .cloudServicePermissionDenied: errorString = "Access to cloud service information is not allowed"
                case .cloudServiceNetworkConnectionFailed: errorString = "Could not connect to the network"
                case .cloudServiceRevoked: errorString = "User has revoked permission to use this cloud service"
                default: errorString = (error as NSError).localizedDescription
                }
                self.delegate?.purchaseFailed(error: errorString)
            case .deferred(purchase: _):
                self.delegate?.purchaseFailed(error: "deferred")
            }
        }
    }

To Reproduce User feedback

Expected behavior Unknown error. Please contact support

Platform Information

Screenshots image

zhouwude commented 1 year ago

Did you solve it