Post

Replies

Boosts

Views

Activity

Status code 21002 whenever I try to validate IAP
Hello, I'm working on non-consumable IAP's and when I try to validate a receipt, I always get this status code 21002, which means my receipt-data property was malformed or missing. But I've been doing exactly how I saw on apple's documentation. What am I missing? guard let receiptFileURL = Bundle.main.appStoreReceiptURL,        FileManager.default.fileExists(atPath: receiptFileURL.path) else { return }           let receiptData = try? Data(contentsOf: receiptFileURL, options: .alwaysMapped)               guard receiptData != nil else {         UserDefaults.standard.set(false, forKey: "isSubscribed")         return       }               var recieptString = receiptData?.base64EncodedString() ?? ""               let jsonDict : [String : Any] = ["receipt-data" : recieptString,                        "password" : Constants.ConstantValues.autoRenewableReceitPassword.rawValue,                        "exclude-old-transactions" : false]               let httpBody = try? JSONSerialization.data(withJSONObject: jsonDict, options: [])               let storeURL = URL(string: Constants.ConstantValues.verifyReceiptSandboxURL.rawValue)!               var storeRequest = URLRequest(url: storeURL)               storeRequest.httpMethod = "POST"       storeRequest.httpBody = httpBody               storeRequest.setValue("Application/json", forHTTPHeaderField: "Content-Type")               let task = URLSession.shared.dataTask(with: storeRequest) { [weak self] (data, response, error) in                   if let data = data, let jsonData = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) {             /* Status code is always 21002 */                      }                     }       }               task.resume()
2
0
9.2k
Feb ’21
Apple rejecting app because they can't test IAP's
My app was rejected 3-4 times because of some error that doesn't load IAP's for apple engineers. It loads perfectly for my Test Flight users and works for me as well, it doesn't load on simulators though and I get this error: Error Domain=SKErrorDomain Code=0 "UNKNOWN_ERROR" UserInfo={NSLocalizedDescription=UNKNOWN_ERROR, NSUnderlyingError=0x60000013ea00 {Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response}}} I can't load IAP's in the simulator at all without a storekit config file, and even with that attatched, apple rejected my app This was their response : Guideline 2.1 - Performance - App Completeness We found that your in-app purchase products exhibited one or more bugs when reviewed on iPhone running iOS 14.5 on Wi-Fi. We cannot select an In-App Purchase product to purchase. No action took place after we tapped on any In-App Purchase product. Next Steps When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead. They ask me to change validation servers, but I am not validating the receipts in my app at all! When I asked about it, they didn't reply to my message I'm very confused right now because I have other apps with IAP's already live and they were approved pretty easily, I tried using the same exact code as one of those apps and even it was producing an error in the simulator, but working fine in the app store build on an actual device. Every time Apple rejects my app, the IAP's move from waiting for submission to Developer action needed, and I fix that before uploading a new build so the problem is not that. It's weird that it won't load IAP's for apple engineers but it will load for my test flight users. Any help is greatly appreciated!
3
0
2.1k
May ’21
Siri intents crashing when resolving with needsValue
So I'm working on a logging app that uses Siri to log diaper changes for babies. There are 3 types of diaper changes, wet, dirty, both. I created a enum for these values in the intent definition file and made it configurable and resolvable. in the resolve function, I added this line of code public func resolveDiaperType(for intent: DiaperIntentIntent, with completion: @escaping (DiaperTypeResolutionResult) -> Void) { let needsValue = intent.diaperType == .unknown if needsValue { completion(.needsValue()) } else { completion(.success(with: intent.diaperType)) } } But as soon as .needsValue() is called, the UI will ask user to select one value, and then crash the app. I tried removing a lot of different params and code blocks, needsValue is the only thing that's crashing for me. If I make the default diaperType parameter as .dirty instead of .unknown, it works. Basically it won't let me work with an empty enum parameter. I get the SIGABRT error and the app crashes. I have like 4 intents. 3 of them uses enums. All 3 crash on the enum input UI. all 3 work correctly when the enum is given a value instead of .unknown. The problem is, I NEED to ask user the type. If I give it a default value and resolve it with .needsValue(), it still crashes. I cannot ask the user for a value. I haver made siri intents with enums input before. And those intents STILL WORK. They were just made for older Xcode versions Is this an Xcode bug? Testing on iOS 17.2 simulator Xcode 15.2
0
0
610
Mar ’24