Do you have a bunch of HTML files that are local to your iOS project? Would you like to run through them and parse out keywords for your own search method? While I won’t go into the indexing and searching (separate topic), digging through your own stuff dynamically is actually pretty easy when you put a few pieces together. I give you a method which finds all the HTML pages in your application.
- (void)indexAllHTML { NSArray *pages = [[NSBundle mainBundle] pathsForResourcesOfType:@".html" inDirectory:nil]; for(int i=0; i<[pages count]; i++){ NSString *path = [pages objectAtIndex:i]; NSString *pageData = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; NSArray *foo = [path componentsSeparatedByString:@"/"]; NSString *shortPath = [foo lastObject]; //Perform your indexing magic here } }
