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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:37:02+00:00 2026-05-17T22:37:02+00:00

I have an NSMutableArray defined in my AppDelegate class: NSMutableArray *devices; I populate the

  • 0

I have an NSMutableArray defined in my AppDelegate class:

NSMutableArray *devices;

I populate the array from a class in the didFinishLaunchingWIthOptions method:

Devices *devs = [[Devices alloc] init];
self.devices = [devs getDevices];

The getDevices method parses a json string and creates a Device object, adding it to the array:

NSMutableArray *retDevices = [[NSMutableArray alloc] initWithCapacity:[jsonDevices count]];

for (NSDiectionary *s in jsonDevices) {
    Device *newDevice = [[Device alloc] init];
    device.deviceName = [s objectForKey:@"name"];

    [retDevices addObject: newDevice];
}

return retDevices;

I then use the AppDelegate class’s devices array to populate a tableView. As seen in the cellForRowAtIndexPath method:

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
Device *d = (Device *)[appDelegate.devices objectAtIndex:indexPath.row];

cell.label.text = d.deviceName;

When the tableview is populated initially, it works. But when I scroll through the list, and the cellForRowAtIndexPath is executed again, d.deviceName throws an error because it has gone out of scope.

Can anyone help me understand why? I’m sure it has something to do with an item being released… but… ??

Thanks in advance.

  • 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-17T22:37:02+00:00Added an answer on May 17, 2026 at 10:37 pm

    If it is indeed a problem with memory management, answering these questions should lead you to an answer:

    • Is deviceName declared as a retain or copy property by the Device interface declaration?
    • Is -deviceName synthesized? If not, how is it implemented?
    • Is devices declared as a retain property by the app delegate class’s interface declaration?
    • Is devices synthesized? If not, how is it implemented?

    Of course, it might not be a problem with memory management. It would help a lot if you were to provide the actual text of the error message and any provided backtrace.

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

Sidebar

Related Questions

I have a class that subclasses NSMutableArray. I init it using: MyClass class =
What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate.
having an issue using a NSMutableArray; In my implementation file applicationDidFinishLaunching method I have
I have a Owners class defined that is used just fine in existing classes.
I have an NSMutableArray I am trying to populate using a for-loop and making
i have the following item to display in my table redFlowers = [[NSMutableArray alloc]
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
I have 2 arrays, 1 in the viewDidLoad method and 1 in the add
I currently have an object called Station defined as: @interface RFStation : NSObject {
i have 2 NSMutableArray with same type. i want to add second nsmutablearray to

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.