Quote:
Originally Posted by BSDimwit
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...