M Jesse
M Jesse

Reputation: 2273

Can a plist file be too big?

I'm working on a reference app that loads a plist file that can be searched.

The plist file is about 6kb with about 600 entries.

I have been working with the simulator and all works ok, however when I load it onto a device none of the data is there. Just an empty table.

I think the file may be too big because I can load a plist with 20 entries and it loads fine on the device.

If the file was too large wouldn't the whole app just crash?

Does anyone have any suggestions?

This is how I load my plist file

NSString* myFile = [[NSBundle mainBundle] pathForResource:@"myPlistFile" ofType:@"plist"];
array = [[NSMutableArray alloc] initWithContentsOfFile:myFile];

Upvotes: 1

Views: 473

Answers (1)

sudo rm -rf
sudo rm -rf

Reputation: 29524

What it sounds like to me is that either your plist isn't even getting copied at all onto the device, or you're using case-sensitive file naming.

First see if the file exists at all:

NSString *myFilePath = [[NSBundle mainBundle] pathForResource:@"myPlistFile" ofType:@"plist"];
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:myFilePath];

Check that boolean (using the debugger or by logging, either way). If the file exists, then I suspect that you're using a wrong case when trying to access the filename. Filenames are case-sensitive on iOS devices, unlike the Simulator. For example, lets say your plist was named myAwesomeStuff.plist. If you tried to access myawesomestuff.plist on the Simulator, it would work just fine. Not so on the device. Make sure you are using the correct case on your file names.

Upvotes: 3

Related Questions