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

mrl72

macrumors regular
Original poster
Apr 20, 2008
221
19
I am retrieving a list of my friends from Facebook and storing them in a plist, however I cannot completely understand how best to do this. I have the writing to plist fine, in fact I am going through the results returned from FB (an array) and adding the results to a NSMutableDictionary and then writing the results to a plist. Here's what's happening, or what I don't understand and could do with some guidance on.

Results:

Code:
	<dict>
		<key>first_name</key>
		<string>John</string>
		<key>last_name</key>
		<string>Doe</string>
		<key>name</key>
		<string>John Doe</string>
		<key>pic_big</key>
		<string>http://blahblah.jpg</string>
		<key>uid</key>
		<real>123456</real>
	</dict>
	<dict>
		<key>first_name</key>
		<string>Jane</string>
		<key>last_name</key>
		<string>Doe</string>
		<key>name</key>
		<string>Jane Doe</string>
		<key>pic_big</key>
		<string>http://blahblah.jpg</string>
		<key>uid</key>
		<real>2345</real>
	</dict>

So questions:

1. How can I say search the array above and pull out someone with uid=2345?

2. Having done #2 above, I then need to update the array for uid=2345 changing, say, the pic_big string to something else.

3. Write back to plist.

Is something like this possible, or am I barking up the wrong tree? :)

Cheers
 
If you want a collection indexed on UID why don't you store the data as a dictionary of dictionaries with the outer dictionary using UID as keys?
 
Yeap that's exactly what I would like to do but not quite sure how the dictionary works either. So a dictionary is the best way?

Cheers.

Edit: Never mind, read the help and figured it out :)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.