I'm currently working on a solution with In-App purchases which validate to our back-end server and I've come across some issue while sending the receipt to our server. When I retrieve it by doing
NSURL *receiptUrl = [bundle appStoreReceiptURL];
receipt = [NSData dataWithContentsOfURL:receiptUrl];
NSString *string = [receipt base64EncodedString];
the result is something like this (just an excerpt)
MIIVOAYJKoZIhvcNAQcCoIIVKTCCFSUCAQExCzAJBgUrDgMCGgUAMIIE6QYJKoZI\r\n
There are these characters \r\n which appear quite often dividing this indicate return and new line. Is there any way to convert to a string without these characters? Is it safe to just use stringByReplacingOccurrencesOfString: to remove them or should I assume these characters could appear randomly on the base64 string without the "new line" meaning? If I validate the receipt with these characters it returns 21002 which indicates receipt-data is malformed, but by using stringByReplacingOccurrencesOfString it validates OK, so my question is if I should be removing these characters by hand or should I convert the receipt somehow?