Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 859439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:40:53+00:00 2026-05-15T08:40:53+00:00

NSArray* address = [NSArray arrayWithArray:[detailItem addressArray]]; NSLog(@address = %@, address); NSString* addressToString = @;

  • 0
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];}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:40:53+00:00Added an answer on May 15, 2026 at 8:40 am

    Your “address” is an NSArray of NSDictionary, not an NSArray of NSArray.

    To get the values of the dictionary as an array, you can use

    [theDictionary allValues]
    

    but there is no guarantee on the order. And I think what you actually need is:

    NSMutableString* addressToString = [NSMutableString string];  // use mutable string!
    for (NSDictionary* item in address) {     // use fast enumeration!
      [addressToString appendFormat:@"%@, \"%@\", %@, %@, \"%@\", %@\n",
       [item objectForKey:@"City"], 
       /* etc ... */
      ];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line of code that keeps crashing NSArray* address = [NSArray arrayWithArray:[[[access.filteredResults
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *myPlistPath =
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [path objectAtIndex:0]; NSString *databasePath =
NSArray arrayWithObjects needs nil at the end, NSString stringWithFormat and NSLog() doesn't. Why? [NSArray
I'm trying to pass an NSString address object to a UILabel text, but I
My issue is then I retrieve my NSArray of Store objects, all my NSString
I have code that takes a title and an address of a location,then get
I have an app that uses address book. I am trying to display sorted
I have an App that does forward geocoding (get coordinates given address) to display
I use plist file to store annotation data that have Name, Address, Coordinates and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.