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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:30:44+00:00 2026-05-31T08:30:44+00:00

I’ve declared two NSMutableArrays in the interface of one of my view controllers, as

  • 0

I’ve declared two NSMutableArrays in the interface of one of my view controllers, as you can see in the code below. However, after synthesizing the properties, I attempt to initialize my class’ ivars in viewDidLoad. If I step over this process in debugger, I see that it is offsetting memory allocation by one ivar, if that makes any sense. So, for example, as I am initializing the first NSMutableArray, I can watch the memory address get assigned to the other NSMutableArray ivar. The NSMutableArray that the code should be initializing remains a null memory address. This odd “offset” in memory allocations is try for initializing the second NSMutableArray too…it is initialized in my DataHelper ivar’s memory location. This is causing errors to be thrown later in the code like:

-[DataHelper count]: unrecognized selector sent to instance

Where it is expecting a reference to an NSMutableArray in memory, it is instead pointing to the DataHelper memory address. Has anyone ever experienced anything like this? I’m using ARC, the latest version of Xcode, and iOS 5.1.

MyViewController.h

#import <UIKit/UIKit.h>
#import "DataHelper.h"

@interface MyViewController : UIViewController
{
    DataHelper *dataHelper;
    NSMutableArray *recentPosts;
    NSMutableArray *popularPosts;
}

@property (nonatomic, strong) DataHelper *dataHelper;
@property (nonatomic, strong) NSMutableArray *recentPosts;
@property (nonatomic, strong) NSMutableArray *popularPosts;

@end

viewDidLoad in MyViewController.m

@implementation MyViewController

@synthesize dataHelper, recentPosts, popularPosts;

- (void)viewDidLoad
{
    [super viewDidLoad];

    recentPosts = [[NSMutableArray alloc] init];
    popularPosts = [[NSMutableArray alloc] init];
    dataHelper = [[DataHelper alloc] init];

    // I've also tried initializing the ivars as above, with "self." prefix

    recentPosts = [dataHelper getSuggestionsByMostRecent:1];
    popularPosts = [dataHelper getSuggestionsByPopular:1];
}
  • 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-31T08:30:45+00:00Added an answer on May 31, 2026 at 8:30 am

    There are memory readout issues with LLDB in XCode (4.3.1 seems to be affected too) so i suggest you use GDB for debugging.

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

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.