something embarrassing gift too faced cinnamon kiss discontinued pink angel coupons wild west boots coupon
Saturday, November 26, 2022
HomeiOS Developmentswift - Income Cat iOS - How do I validate purchases in...

swift – Income Cat iOS – How do I validate purchases in order that jailbroken iPhones cannot crack the In App Buy?


I just released an app for iOS and I used Revenue Cat to help with IAPs. I just found out that anyone with a jailbroken iPhone can make fake purchases that give them the “goods” without making a payment. Does Revenue Cat have a way to verify and make sure this doesn't happen?

Here is the code for when a certain is made in the app (button press):

guard let package = offering?.availablePackages[2] else {
    print("No available package")
    return
}
Purchases.shared.purchasePackage(package) { (trans, info, error, cancelled) in
    // handle purchase
    if trans?.transactionState == .purchased {
        if let currentUser = Auth.auth().currentUser {
            var ref: DatabaseReference!
            ref = Database.database().reference()
            ref.child("users/(currentUser.uid)/score").getData(completion:  { error, snapshot in
              guard error == nil else {
                print(error!.localizedDescription)
                return;
              }
              let score = snapshot.value as? Int ?? 0;
                let newScore = score + 100
                ref = Database.database().reference()
                ref.child("users").child(currentUser.uid).updateChildValues(["score": newScore])
            });
       }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments