NSArray* address = [NSArray arrayWithArray:[detailItem addressArray]];
NSLog(@"address = %@", address);
NSString* addressToString = @"";
int arrayCount = [address count];
for (int i = 0; i < arrayCount; i++) {
addressToString = [addressToString stringByAppendingString:[address objectAtIndex:i]];
if (i == arrayCount -1) {
addressToString = [addressToString stringByAppendingString:@""];
} else {
addressToString = [addressToString stringByAppendingString:@", "];
}
}
address is an NSArray that holds an address
2010-06-23 09:05:19.346 iPhoneExample[1093:207] address = (
{
City = "Cupertino";
Country = "United States";
CountryCode = us;
State = CA;
Street = "1 Infinite Loop";
ZIP = 95014;
}
)
I'm trying to go thru the array and create a CSV string so it would look like
Cupertino, "United States", us, CA, "1 Infinite Loop", 95014
However, I keep crashing on
addressToString = [addressToString stringByAppendingString:@", "];
Message I get is
*** -[NSCFDictionary stringByAppendingString:]: unrecognized selector sent to instance 0x1c2f10
UPDATED: detailItem is an object of type ABContact (custom class).
ABContact has a property called addressArray
@property (nonatomic, readonly) NSArray *addressArray;
the definition of my addressArray is
- (NSArray *) addressArray {return [self arrayForProperty:kABPersonAddressProperty];}