Post

Replies

Boosts

Views

Activity

Unable to get product info from Apple Store
Here is the code, I tried two ways to make a test, pids = [ "me_xxxxxxxx_xxxxxxxx_sub_pro_yearly" , "me_xxxxxxxx_xxxxxxxx_sub_pro_lifetime" ] L.d { "Requesting products from apple: \(pids)" } let appProducts = try await Product.products(for: pids) What's wrong with the code I copied from Apple Store Document? The product info was configed on Apple Store Connect, and it's waiting to commit now. It proved that the configuration of product is fine. I tired to use XCode storekit configuration to request product info, It also works fine. So, I don't know why? Here is detail of the log, Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={NSUnderlyingError=0x280303c00 {Error Domain=AMSErrorDomain Code=1 I logged Sandbox account in iPhone (Setting-Apple Store-Sandbox). It used to work well and I even made a purchase. But with no reason, it doesn't work any more! And yesterday, I was even unable to log in the Apple Store Connect suddenly with no reason. And I contacted you for support, not work. Few hours later, it worked as usual.
1
1
521
Jun ’23
Get wrong receipt data from Apple
I have been stuck on this issue for a long time. I'm a newer in Swift and I couldn't find a way to solve this problem. I got the receipt data from my App, the code is, if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL, FileManager.default.fileExists(atPath: appStoreReceiptURL.path) { do { let receiptData = try Foundation.Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped) print(receiptData) // Read ReceiptData print("receipt: \(receiptData.base64EncodedString(options: []))") } catch { print("Couldn't read receipt data with error: " + error.localizedDescription) } } which is copied from sample code from Apple Developer Document. And this is one of the receipt data got from sandbox environment, MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBQTGCAT0wDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwHgIBAgIBAQQWDBRtZS5zaG91aGVuZy5QYXNzd29yZDALAgEDAgEBBAMMATEwEAIBBAIBAQQI0WdppwwAAAAwHAIBBQIBAQQURNzHFZljh//5CxFffAS8e8DqdhAwCgIBCAIBAQQCFgAwHgIBDAIBAQQWFhQyMDIzLTA1LTA4VD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livcDWHUCeV7k4kHd2UtKoS3BuuGeZ+7OKVZ/vHSi4XyrRc581Rze7RtN2EPLwaezNYplx+WCKhEg4xL2LZyW5q2wzZa3Ywpp4SA/pzMEnDcbPZDxtgFkzjMo2BioRG41Jzgj/ZsBHKEvrWsErCVYspaoJA3syMdzohXhIzsDFEhFqDwyuLwXKb3pkfyAsdeZMsRLT/eMfXg19uFjXoHzkf2Orl5orwyrY0LLh1VoNORtvZyipEoPWh3htmb1eswrgmM726sOObWnrt0CBPYc9cFHRxF2Npdx/alga3mB2N1Ls/6wZXQwVL4oP9YnI1ysdHuwrkQWnPU8xggGPMIIBiwIBATBkMF8xETAPBgNVBAMMCFN0b3JlS2l0MREwDwYDVQQKDAhTdG9yZUtpdDERMA8GA1UECwwIU3RvcmVLaXQxCzAJBgNVBAYTAlVTMRcwFQYJKoZIhvcNAQkBFghTdG9yZUtpdAIBATANBglghkgBZQMEAgEFADANBgkqhkiG9w0BAQsFAASCAQAWJXl3LfA9Hrc0NHeKdhv+3Bo7fKtz91pKW/FAZLbgEyavqrXXdbC0rfuk3OSM/2e16tpW2WFq9c5Xj5xSNNwkq7J0ecPbJfh2PheC1G4F6JJrJZze6K61PIwR0oz/Uwmiq/iZ3BBHxFiMR7XBrqoGXuVErlSFfQ2AH7BW+URSaJj98c1ANXoT9RXtLio/N+HtHSniRI+mfq4SAMJ+hBPwKFWhwKydz0MMNbKMDLtR8VoMWAGgyrsQ7elkFblhlbVG8OXqsGjkUH1AvxV2fV7J8IcsizAuzAABaUISMfMwxEQjsrLpTgkFhB4shaHUFUemLp1Mam2Pr1l+7xTxSd8yAAAAAAAA But when I use it to verify in sandbox environment, I always got 21002 error. Then I found some receipt data from stackoverflow https://stackoverflow.com/questions/33843281/apple-receipt-data-sample/53286406#53286406 . I use them to test my python code, it works. Here is the python code, receipt = "xxxxxx" url = 'https://sandbox.itunes.apple.com/verifyReceipt' headers = {"Content-type": "application/json"} data = json.dumps({"receipt-data": receipt}) res = requests.post(url=url, data=data, headers=headers, verify=False).text print(res) So, it seems that it's the receipt data I got from Apple wrong. I don't know why the receipt data is wrong. Is there anyway to find out the problem? I'm using XCode (Version 14.1 beta 2 (14B5024i)) and a iphone SE to make a test. It purchased and verified according to StoreKit 2.
1
1
888
May ’23