PDA

View Full Version : plist question




tiltem
Oct 24, 2010, 11:07 AM
I am writing a simple rss reader and want to store the url in the plist file. I am first not sure of how and when i should add the url to the plist.

Second once in there I am not sure how to retrieve the url from the plist to send to the xmlParser.

Help with these two things is much appreciated



dejo
Oct 24, 2010, 12:44 PM
I am writing a simple rss reader and want to store the url in the plist file.
Which plist file? You have to realize there can be more than one.

tiltem
Oct 24, 2010, 01:56 PM
pretty new to this, so i am guessing the info.plist file. I would like to be able to set the url in this file and then when parsing call the the variable in the file instead of hard coding the url in .m file. Have not done a lot of modifying of plist files.

dejo
Oct 24, 2010, 02:03 PM
info.plist is part of the app bundle and you cannot modify it from within your app. Sounds like you probably should look into using NSUserDefaults instead.

tiltem
Oct 24, 2010, 02:45 PM
Hey Dejo-
Thanks for the help! I got around what I wanted to do by adding the value into the info.plist and then accessing with:

[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RSSURL"]

not sure if this is correct but it worked :)

dejo
Oct 24, 2010, 03:24 PM
So, you have a single hardcoded URL that the end user is never going to change?

tiltem
Oct 24, 2010, 10:02 PM
Yes, for now that is fine.
I found out how to add other plists and add and pull from them too.

Now I am wanting to filter through the rss items that have links and cache them so they can be viewed when offline. Any idea how this is done? I have been reading on NSURLConnection and NSURLRequest and NSURLCache, but can not figure out how they all fit together, and what should be done to store the pages for offline viewing.

Any suggestions would be great!! Thanks.

tiltem
Oct 25, 2010, 02:00 AM
Got it figured out. Used the URLCache sample from apple to figure out the caching. Thanks again for your help!!