I want to validate my in app purchases using server side. So I use the following code:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction * transaction in transactions) {
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:
{
NSData *reciptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
if(reciptData) {
NSDictionary *parameters = @{@"receipt_data" : [reciptData base64EncodedStringWithOptions:0]};//App crashes here -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
}
}
break;
default:
break;
}
};
}
The weirdest thing is that application crashes on one iPad with iOS 8.0.2 and does not crash on other with the same iOS version.
The worst thing is that I do not have access to device on which application crashes.
As far as I understand - base64EncodedStringWithOptions:
returns nil
but I don't know why.
Can anyone help me?