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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:45:57+00:00 2026-05-31T07:45:57+00:00

I’m using ARC and targeting iOS 5. I’ve declared an NSMutableArray ivar in one

  • 0

I’m using ARC and targeting iOS 5. I’ve declared an NSMutableArray ivar in one of my view controller’s header, initialized it in viewDidLoad, and I’m attempting to manipulate it in some of my view controller’s methods. However, it is behaving very weird. As I send messages to it like “addObject:”, or try to set it to equal to an NSMutableArray, created in the local scope of a method, it is sending the message to other ivars I’ve declared.

For example, one of the errors I keep getting is -[PullToRefreshView count]: unrecognized selector sent to instance. PullToRefreshView is another one of my ivars, but in my code, I am clearly sending the count message to my NSMutableArray ivar. When trying to add an object to the ivar NSMutableArray it’s count (in debugger) stays at 0. I keep searching my code for something I may have overlooked, but it just seems like some kind of ARC memory management fluke. Any ideas? Here’s the relevant areas of my code:

MyViewController.h

@interface MyViewController : UIViewController
{
    PullToRefreshView *pull;
    NSMutableArray *commentsSharesMerged;
}

@property (nonatomic, retain) PullToRefreshView *pull;
@property (nonatomic, retain) NSMutableArray *commentsSharesMerged;

- (void)refreshComments;
- (void)refreshShares;

@end

MyViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    commentsSharesMerged = [[NSMutableArray alloc] init];

    pull = [[PullToRefreshView alloc] initWithScrollView:(UIScrollView *)self.suggestionTable];
    [pull setDelegate:self];
    [self.suggestionTable addSubview:pull];
}

- (void)refreshComments
{
NSURL *url = [NSURL URLWithString:@"http://example.com/comments.json"];
__unsafe_unretained __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];

[request setCompletionBlock:^{
    NSString *responseString = [request responseString]; // Use when fetching text data
    NSData *responseData = [responseString dataUsingEncoding:NSUTF8StringEncoding];

    id jsonObject = [[CJSONDeserializer deserializer] deserialize:responseData error:nil];
    NSLog(@"Connection JSON: %@", jsonObject);

    NSMutableArray *commentsArray = [[NSMutableArray alloc] init];

    for (int i = 0; i < [jsonObject count]; i++)
    {
        NSDictionary *currentCommentData = [jsonObject objectAtIndex:i];

        Comment *comment = [[Comment alloc] init];
        comment.identifier = [[currentCommentData objectForKey:@"id"] intValue];
        comment.firstName = [currentCommentData objectForKey:@"first_name"];
        comment.lastName = [currentCommentData objectForKey:@"last_name"];
        comment.commentText = [currentCommentData objectForKey:@"comment"];

        [commentsArray addObject:comment];
    }

    self.commentsSharesMerged = [commentsArray mutableCopy];

    // I've also tried to add the object using something like this
    //for (Comment *comment in commentsArray)
    //    [commentsSharesMerged addObject:comment];
}];

[request setFailedBlock:^{
    NSError *error = [request error];
    NSLog(@"%@", error);
}];

[request startAsynchronous];
}
  • 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-31T07:45:58+00:00Added an answer on May 31, 2026 at 7:45 am

    I found the solution for my problem. It can be attributed to some kind of memory bug in LLDB debugging. I moved my scheme over to GDB and that fixed my ivar allocation issues.

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.