The problem is that applicationDidFinishLaunching only occurs once so the passedString value will never be searched again if changed.
Try this in the app delegate
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application{
// Configure and show the window
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
//Implement your own boats getter
- (NSArray*)boats{
//I recommend surrounding all of this code before the return with an if statement
//checking to see if passedString has changed to prevent duplicate web calls
NSString *xmlStart = @"http://www.mysite.com/search=";
NSString *searchWord = passedString;
NSString *xmlEnd = @"&xml=1";
NSString *newString;
newString = [xmlStart stringByAppendingString:searchWord];
XML = [newString stringByAppendingString:xmlEnd];
NSURL *url = [[NSURL alloc] initWithString:XML];
NSXMLParser *boatListParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
BoatListParser *parser = [[BoatListParser alloc] initBoatListParser];
[boatListParser setDelegate:parser];
BOOL success = [boatListParser parse];
if(success)
NSLog(@"Success");
else
NSLog(@"Error");
return (boats parsed from xml); //This is where you return the array of BOAT objects
}