Wie man iOS appStoreReceiptURL in Base-64-Codierte Zeichenfolge?

Möchte ich appStoreReceiptURL, um zu sehen, welche version der app Sie jemand gekauft. Wie kann ich diese in einen string?

Teste ich das mit dem herunterladen der app aus dem store, dann läuft eine neue version der app in Xcode. Hier ist, was ich versucht habe:

NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];
NSLog(@"receiptUrl %@",[receiptUrl path]);
if ([[NSFileManager defaultManager] fileExistsAtPath:[receiptUrl path]]) {
        NSLog(@"exists");
         NSError *error;
         NSString *receiptString = [[NSString alloc] initWithContentsOfFile:[receiptUrl path] encoding:NSUTF8StringEncoding error:&error];
         if (receiptString == nil) {
              NSLog(@"Error: %@", [error localizedDescription]);
         } else {
             NSLog(@"Receipt: %@",receiptString);
        }

} else {
        NSLog(@"does not exist");
}

Dies ist, was ich bekomme:

receiptUrl /var/mobile/Applications/E612F261-2D30-416E-BF82-F24xxxx8860/StoreKit/receipt
exists
Error: The operation couldnt be completed. (Cocoa error 261.)

InformationsquelleAutor Tom Kincaid | 2013-09-20

Schreibe einen Kommentar