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 8147853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:29:37+00:00 2026-06-06T14:29:37+00:00

On my viewDidLoad I load from a webservice the first 5 items of an

  • 0

On my viewDidLoad I load from a webservice the first 5 items of an array and put them on a NSMutableArray of mine. Also on this View I have UITableViewController that displays the items of my NSMutableArray with the contents from the webservice. When I scroll to the last item of the UITableView I am loading the 5 next items from the webservice and add them to my NSMutableArray and reloading the table data in order to display all the 10 items.

The problem is that when I try to add to my existing NSMutableArray the 5 new objects from the webservice the program crashes with the message: Exception: -[__NSCFArray insertObject:atIndex:]: mutating method sent to immutable object

The way I am accessing the NSMutableArray in cellForRowAtIndexPath: is like this:

cell.textLabel.text = [[self.myMutableArray objectAtIndex:indexPath.row]objectForKey:@"name"];

Any idea on what it could be?

  • 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-06-06T14:29:39+00:00Added an answer on June 6, 2026 at 2:29 pm

    First, look for warnings in your compiler output. You likely have are assigning an NSArray to an NSMutableArray variable. This will often generate a warning. Your build should have no warnings in it. This is critical for ObjC code (many things you would think of as “errors” are only warnings in ObjC). If you’re ignoring warnings, then you’re going to have a lot of problems.

    You can have this situation without creating a warning if something is cast to id. For example, if you fetch your “NSMutableArray” (really an NSArray) from an array or dictionary, you won’t get a warning about the type mismatch. Look for these situations. Basically, audit each point you assign myMutableArray and make sure that you’re actually assigning a mutable array.

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

Sidebar

Related Questions

OK,First this program can load plist from URL by this code,and I put this
in controller scrollView.autoresizesSubviews = YES; in viewDidLoad of controller I load view object from
I have a TabBarApplication and in one view I load XML-data from an URL.
I have two table view filled in their viewDidLoad with data coming from a
I have a custom view controller that implements the from UITableViewDataSource and UITableViewDelegate protocols.
I have a view controller that I want to present from my root view
I have a NSMutableArray and I would like to use data from it in
I am trying to load three different images from an array into corresponding cells
Possible Duplicate: iPhone Dev - Edit objects in Array from Plist I have a
In my application I try to load contents from a url, store them in

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.