views:

80

answers:

2

Hi,

I've tried using the FileReader class but it only seems to allow access to files outside the app bundle -i.e. the documents folder. But I want to read files within the app bundle - for example obtaining global settings from Phonegap.plist, working out if certain files exist in the www folder and so on.

I have tried a few things but it doesn't seem to work. I can see in the PhoneGap native code it is reading from PhoneGap.plist but this doesn't seem to be available in the Javascript API.

It would be really helpful if somebody could suggest what I am doing wrong, or perhaps it's not possible and I need an update to PhoneGap that I can add to my app. I don't have a clue to program in Objective-C which is the main problem!!

Any ideas would be much appreciated.

Thanks Nick

A: 

I dont know anything about PhoneGap but this is how you do it:

PhoneGapPlistPath = [[NSBundle mainBundle] pathForResource:@"PhoneGap" ofType:@"plist"];

NSDictionary *PhoneGapDictionary = [NSDictionary alloc] initWithContentsOfFile:PhoneGapPlistPath];
Larsaronen
+1  A: 

http://blog.clearlyinnovative.com/post/1090028214/reading-files-within-app-bundle-at-runtime-using

I wrote something to solve this problem

Aaron Saunders