2013-03-15 7 views
8

Quando la verifica di Apple IOS in-app ricevuta d'acquisto con il server di Apple, un numero del nostro ritorno transazione come:iOS In App stato dell'acquisto 21002, java.lang.NumberFormatException

{"status":21002,"exception":"java.lang.NumberFormatException"} 

Posso sapere che cosa è la causa di il problema? Abbiamo seguito la guida all'acquisto dell'app in-Apple, ovvero codificheremo la ricevuta di ritorno dell'app store con Base 64 dal client iOS, prima di inviare la ricevuta a scopo di verifica

Nota: la maggior parte delle nostre transazioni è passata, c'è circa il 10% delle transazioni con l'errore precedente

risposta

8

Un paio di possibili cause:

  • qualcuno che cerca di incidere il vostro verifica della ricevuta IAP. Ci sono alcune tecniche che inseriscono false entrate nella speranza che lo sviluppatore non le verifichi correttamente. L'haus ha questo comportamento.

  • Gli errori durante i test portano a verificare le ricevute che vanno al verificatore di produzione.

Ho visto questi errori abbastanza spesso ma semplicemente non ricordo quale di queste due cause questo messaggio esatto. Penso che lo facciano entrambi. Devo ancora avere un reclamo del cliente dopo averli visti.

Se il volume è abbastanza basso (sfortunatamente, il mio è), andare in iTunes Connect e verificare se ci sono vendite che corrispondono agli errori. Puoi anche dare un'occhiata ai dati della ricevuta per vedere se sembra sospetto.

0

c'è un l'altro posibility, si invia solo pucharse_info invece di tutta la JSON decifrato (con singature ecc)

var receipt = Ti.Utils.base64encode(evt.receipt).text; 
0

quando si verifica la ricevuta, forse si può provare il seguente codice:

NSData *receipt; // Sent to the server by the device 

// Create the JSON object that describes the request 
NSError *error; 
NSDictionary *requestContents = @{ 
    @"receipt-data": [receipt base64EncodedStringWithOptions:0] 
}; 
NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents 
                 options:0 
                 error:&error]; 

if (!requestData) { /* ... Handle error ... */ } 

// Create a POST request with the receipt data. 
NSURL *storeURL = [NSURL URLWithString:@"https://buy.itunes.apple.com/verifyReceipt"]; 
NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:storeURL]; 
[storeRequest setHTTPMethod:@"POST"]; 
[storeRequest setHTTPBody:requestData]; 

// Make a connection to the iTunes Store on a background queue. 
NSOperationQueue *queue = [[NSOperationQueue alloc] init]; 
[NSURLConnection sendAsynchronousRequest:storeRequest queue:queue 
     completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { 
    if (connectionError) { 
     /* ... Handle error ... */ 
    } else { 
     NSError *error; 
     NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; 
     if (!jsonResponse) { /* ... Handle error ...*/ } 
     /* ... Send a response back to the device ... */ 
    } 
}]; 

Riferimento: https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1

Problemi correlati