I’m trying to convert my bundle to NSData so that I can hash the data and have a server verify the hash before allowing downloads. The only problem is that when I try to convert the bundle to NSData, I get Error: The operation couldn’t be completed. (Cocoa error 257.) I looked up error 257 and it means that the bundle couldn’t be read due to a permissions problem. What am I doing incorrectly? Thanks for your help.
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
NSLog(@"%@", bundlePath);
NSError *error;
NSData *bData = [NSData dataWithContentsOfFile:bundlePath options:nil error:&error];
NSLog(@"Error: %@", [error localizedDescription]);
If piracy protection is your ultimate goal, refer to this for a little insight and code.
http://thwart-ipa-cracks.blogspot.com/2008/11/detection.html?m=1