Guest User

Untitled

a guest
Dec 7th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. NSString *stringReceipt = [[[NSString alloc] initWithData:transaction.transactionReceipt encoding:NSUTF8StringEncoding] autorelease];
  2. stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@"=" withString:@":"];
  3. stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@";" withString:@","];
  4. NSRange range = NSMakeRange([stringReceipt length] - 3, 1);
  5. stringReceipt = [stringReceipt stringByReplacingCharactersInRange:range withString:@""];
  6. NSDictionary *tempDictionary = [stringReceipt JSONValue];
  7. // NSLog(@"%@", tempDictionary);
  8. NSString *purchaseInfo = [tempDictionary objectForKey:@"purchase-info"];
  9. // NSLog(@"%@", purchaseInfo);
  10. NSData *receiptData = [self decodeBase64WithString:purchaseInfo];
  11. NSString *decodedString = [[[NSString alloc] initWithData:receiptData encoding:NSUTF8StringEncoding] autorelease];
  12. decodedString = [decodedString stringByReplacingOccurrencesOfString:@"=" withString:@":"];
  13. decodedString = [decodedString stringByReplacingOccurrencesOfString:@";" withString:@","];
  14. NSRange decRange = NSMakeRange([decodedString length] - 3, 1);
  15. decodedString = [decodedString stringByReplacingCharactersInRange:decRange withString:@""];
  16. NSDictionary *decodedDict = [decodedString JSONValue];
  17. NSString *originalID = [decodedDict objectForKey:@"original-transaction-id"];
  18. [self recoverSubscription:originalID];
  19. NSLog(@"%@", originalID);
Add Comment
Please, Sign In to add comment