Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-11-2009, 11:52 AM   #7 (permalink)
JoeBlaze
New Member
 
Join Date: Jan 2009
Posts: 77
Default

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
}
JoeBlaze is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,353
Threads: 39,148
Posts: 171,625
Top Poster: smasher (2,577)
Welcome to our newest member, pyrrho
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:31 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.