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

  • Home
  • SEARCH
  • 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 3456554
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:45:02+00:00 2026-05-18T09:45:02+00:00

I have an NSMutableArray i am trying to convert into a string. Declaring my

  • 0

I have an NSMutableArray i am trying to convert into a string.
Declaring my NSMutableArray…

    NSMutableArray *listData;  

And later inside a method…

NSString *foo = [listData componentsJoinedByString:@"|"];  
NSLog(@"%@",foo);  

It seems no matter what i try i keep getting EXC_BAD_ACCESS.
To make sure each element in my array was an NSString i also tried this…

NSMutableArray *mArray = [[NSMutableArray alloc] init];  
for (id ln in listData) {  
    NSString *boo = [NSString stringWithFormat: @"%@",ln];  
    [mArray addObject:boo];  
}  
NSString *foo = [mArray componentsJoinedByString:@"|"];  
NSLog(@"%@",foo);  

I can manipulate my NSMutableArray by adding/deleting objects in the same method or other methods inside my class. But when i try “componentsJoinedByString” the error pops up. Does anyone have any advice or another way i can combine this array into a single NSString?

  • 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-18T09:45:03+00:00Added an answer on May 18, 2026 at 9:45 am

    In the code you’ve given, there will never be an NSMutableArray for listData. At some point in your code, you’ll need to create one, and presumably populate it.

    Edit
    Okay, so you may get into memory management problems here, so let’s be a bit clearer:

    You’re synthesizing getters and setters for the instance variable, so it’s good practice to use those to access it, they’ll take care of retain and releasing appropriately.

    To set listData you can simply use

    self.listData = [listManage getList:[[NSUserDefaults standardUserDefaults] stringForKey:@"list_name"] list:@"LIST"]; 
    

    or

    [self setListData:[listManage getList:[[NSUserDefaults standardUserDefaults] stringForKey:@"list_name"] list:@"LIST"]];
    

    if you prefer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSMutableArray object that I want to add custom methods to. I
Can someone please show me the code for sorting an NSMutableArray? I have the
I have been trying to figure out if it is possible to programmatically resize
I'm trying to follow this tutorial on binding: http://andrehoffmann.wordpress.com/2009/09/03/phonebook-tutorial-for-dummiesxcode-3-1-3/ but the app keeps crashing
I'm trying to save an NSArray as a value in an NSMutableDictionary. When I
I am trying to create a preference pane which will reside within system preferences.
I am trying to subclass NSArray , but it crashes the app when trying
How would I go about sorting an array of NSString Objects by a custom
This is probably an simple problem but would someone nice be able to give

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.