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 am trying to store numbers inside the NSMutableArray, and have wrapped them like
What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate.
I have a NSMutableArray and it has the users high scores saved into it.
I have an NSMutableArray that I'm trying to store and access some structs. How
I have two NSMutableArrays: NSMutableArray* currentMessages NSMutableArray* items I am trying to copy the
i have been trying to copy text input from alertview textfield to a NSMutableArray
I have a custom class MDRect that i am trying to add an NSMutableArray
I've been running into this problem a lot lately. I have an NSMutableArray called
I am trying to add images that have been stored to a NSMutableArray. As
I'm trying to have an enum as part of my method signature and I

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.