2014-11-24 122 views
0

我想驗證IAP併發送到我的服務器收據,然後我發送到蘋果服務器進行驗證,我正在使用沙箱帳戶,並且我得到所有時間狀態21002(收據丟失或格式錯誤)。我的目標C代碼如何使用base64在客戶端`transaction.transactionReceipt`上編碼?

SKPaymentTransaction *transaction 

對象,我送

transaction.transactionReceipt

到我的服務器,然後打包,並通過蘋果服務器。如何在客戶端編碼

transaction.transactionReceipt with base64?

我需要使用base64在客戶端transaction.transactionReceipt上進行編碼嗎?

回答

2

由於iOS7還有另一種獲取收據數據的方式。這是我做的:

NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL]; 

NSData *receiptData = [NSData dataWithContentsOfURL:receiptUrl]; 

NSString *receiptBase64 = [receiptData base64EncodedStringWithOptions:0]; 

然後您發送receiptBase64到你的服務器:)

相關問題