Hey guys, I stumbled into a little snippet of code on how to detect if your app is pirated or not. I added a few features into it and here it is:
Add this to AppController.mm (about 75% of the way down) under “applicationDidFinishLaunching”
NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];
if ([info objectForKey: @"SignerIdentity"] != nil)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"YOUR TITLE" message:@"YOUR MESSAGE"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
This checks to see if the app has been cracked. If the app has been cracked, it opens up a little alert window (which you can modify to say whatever you want) with an okay button.
Here’s the landscape version:
NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];
if ([info objectForKey: @"SignerIdentity"] != nil)
{
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"A Message From AppStoreGamer" message:@"We are aware this is a pirated version of our app. We will continue to allow you to use this application, just remember it takes a lot of time and effort to produce what you are about to use."
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
and here’s my own little version which incorporates part of the Flurry API (a great analytical program for iPhone apps). If the app is cracked, it sends the Flurry servers a “Pirate” string in which you can keep count how many pirates vs legit users you have. (this one’s landscape)
NSBundle *bundle = [NSBundle mainBundle];
NSDictionary *info = [bundle infoDictionary];
if ([info objectForKey: @"SignerIdentity"] != nil)
{
[FlurryAPI logEvent:@"Pirate"];
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"A Message From AppStoreGamer" message:@"We are aware this is a pirated version of our app. We will continue to allow you to use this application, just remember it takes a lot of time and effort to produce what you are about to use."
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
Hope this helps you guys!