Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-01-2009, 06:07 PM   #5 (permalink)
AlanTaylor
Registered Member
 
Join Date: May 2009
Posts: 13
Default

Quote:
Originally Posted by BSDimwit View Post
You are missing the point. You are trying to get a list of cities from the address book right?

You are already doing that by in the first section of your code here...

Code:
ABMutableMultiValueRef addressMulti = ABRecordCopyValue(person, kABPersonAddressProperty);
		NSMutableArray *address = [[NSMutableArray alloc] init];
		int i;
		for (i = 0; i < ABMultiValueGetCount(addressMulti); i++) {
			NSString *city = [(NSString*)ABMultiValueCopyValueAtIndex(addressMulti, i) autorelease];
			[address addObject:city];
		}
Why are you doing the other stuff below that. Your address array already has the cities in it? Perhaps you aren't being specific enough as to what you are trying to accomplish. The first error I pointed is that you trying to turn a string into a dictionary...which won't work.
The section of code you just quoted is actually giving me the entire address - I just want to extract the city from that.

The rest of the code checks first to see if there is an address for that person, and if there is I want it to then extract the city from that with the kABPersonAddressCityKey.

Everything else I have done with the addressbook has been single items such as names and images, this is the first time I have tried to take a value from something that has several.

EDIT: changing city to be NSMutableDictionary still gives an error - but seems to actually be working on both the Simulator and the phone...
AlanTaylor is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,835
Threads: 89,209
Posts: 380,641
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Aubrey69
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:12 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.