bizz84 / bizz84/SwiftyStoreKit

Apple always rejects app because of in app purchase

Open
#397 33 comments 0 reactions 0 assignees View on GitHub
answered area: receipt-validation type: bug
Dominant language
Swift
Stars
6.7k
Forks
801
PR merge metrics
No merged PRs in 30d

Description

### Bug Report
**Apple says,**

> We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 11.4.1 on Wi-Fi connected to an IPv6 network.
>
> Specifically, we are still unable to purchase IAP in your app. Error dialog appears.

**Expected Results**
I didn't expect to have a problem when Apple checked in-app purchases.

**Actual Results**
A problem happened. Error dialog always appears when apple checks the app. `errorAlertDialog()`

### Additional Context
- Platform: iOS
- Purchase type: non-consumable
- Environment: production
- SwiftyStoreKit Version: 0.13.3

**Related Issues**
- #369 IPv6 Network Rejection & Network Error
- #81 IPv6 network issue
- #515 Sandbox testing delays in URL loading

### Code
```swift
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "2030202")
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
switch result {
case .success(let receipt):
let productId = "xxxxxxxxxxxxxxx"
let purchaseResult = SwiftyStoreKit.verifyPurchase(
productId: productId,
inReceipt: receipt)
switch purchaseResult {
case .purchased(let receiptItem):
// Success
case .notPurchased:
SwiftyStoreKit.restorePurchases(atomically: true) { results in
if results.restoreFailedPurchases.count > 0 {
self.errorAlertDialog()
} else if results.restoredPurchases.count > 0 {
print("success")
} else {
print("Nothing to Restore")
//purchase
SwiftyStoreKit.purchaseProduct("xxxxxxxxxxxxxxx", quantity: 1, atomically: true) { result in
switch result {
case .success(let purchase):
SwiftyStoreKit.finishTransaction(purchase.transaction)
case .error(let error):
self.errorAlertDialog()
}
}
}
}
}
case .error(let error):
self.errorAlertDialog()
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.