Skip to content

Instantly share code, notes, and snippets.

@theawesomecoder61
Created October 20, 2016 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theawesomecoder61/cdc2b6cd5380d7b4e8384bdcae08490d to your computer and use it in GitHub Desktop.
Save theawesomecoder61/cdc2b6cd5380d7b4e8384bdcae08490d to your computer and use it in GitHub Desktop.
A code snippet written in Cocoa (Objective-C) that detects if an application was downloaded from the Mac App Store, that returns as a boolean.
- (BOOL)isFromMAS:(NSURL *)appURL {
bool mas = NO;
if(appURL != nil) {
mas = [[NSFileManager defaultManager] fileExistsAtPath:[[appURL URLByAppendingPathComponent:@"/Contents/_MASReceipt/receipt"] relativePath]];
}
return mas;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment