title: Matching an NSString with part of a text paragraph on a website. - iPhone SDK
body: <p>So basically I'm working on an application, and one of the features is an anti-cracking feature. It checks the webpage for the UDID number of the device, and if it is there, it allows the application to run, if it's not there, it runs exit(0);. So far, this is what I have.</p>
  
  <p>This is in my AppDelegate.m</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
      [window addSubview:mainViewController.view];
  
      if ([[[UIDevice currentDevice] uniqueIdentifier] isEqualToString:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://example.com" ]]]) {
          NSLog(@"Match!");
          [window makeKeyAndVisible];
      }
      else {
          NSLog(@"No match.");
          alertView = [[UIAlertView alloc] initWithTitle:@"Access denied!" message:@"You aren't using an official version of this application." delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
          [alertView show];
          [alertView release];
      }
  
      return YES;
  }
  
  - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
      if (buttonIndex == 0) {
      exit(0);
      }
  }
  </code></pre>
  
  <p>And so basically, where you see </p>
  
  <pre><code>if ([[[UIDevice currentDevice] uniqueIdentifier] isEqualToString:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://example.com" ]]]) {
  </code></pre>
  
  <p>When it runs that, it can only detect all of the text, rather than indexing it and finding that UDID number. So I can only put 1 UDID number on there, therefore making every user's application crash. I want to set it up so that I can have as many things on there as I want, and it will just index it and search for that UDID number on the page. Can anybody help me please? It's very important! </p>
  
  <p>Thank you very much!</p>