Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

teengohan

macrumors newbie
Original poster
May 20, 2011
27
0
Hi all,

Earlier I was experementing with reading in a .plist file in my app, now I am trying to write code to access this file from a server.

Before I started I had to make sure I was not still accessing a local copy so I deleted the file from the supporting files folder in Xcode and uninstalled the app from the simulator, then to be extra sure I reset the content and settings of the simulator.

The odd thing is that when I run the app now it still reads all the data from the file which should not be the case, my code is below:

Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	// Override point for customization after application launch.
	[window makeKeyAndVisible]; 
	// create a pointer to a dictionary and a temporary dictionary
	NSDictionary *dictionary;
	NSDictionary *tempDict;
	
	// read "productFeed.plist" from application bundle
	NSString *path = [[NSBundle mainBundle] bundlePath];
	NSString *finalPath = [path stringByAppendingPathComponent:@"productList.plist"];
	dictionary = [NSDictionary dictionaryWithContentsOfFile:finalPath];
	
	// dump the contents of the dictionary to the console
	for (id key in dictionary) {		
		tempDict = [dictionary objectForKey:key];
		NSLog(@"Product Name = %@", [tempDict valueForKey:@"name"]);
	}

	self.window.rootViewController = self.viewController;
	[self.window makeKeyAndVisible];
    return YES;
}

What it does is read in the plist and output a list of product names from the plist to the console.

All I need to know is how to clear the old .plist file from the simulator, I think I know how to access the plist remotely already but I can't test it untill I know for sure the local file is gone.

Can anyone help me do this?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.