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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:57:54+00:00 2026-06-14T07:57:54+00:00

– (void)viewDidLoad { [super viewDidLoad]; [VenueManager searchNear:@Orlando onLoad:^(NSArray *objects) { self.locationObjects = objects; [self.tableView

  • 0
- (void)viewDidLoad
{
    [super viewDidLoad];
    [VenueManager searchNear:@"Orlando"
                      onLoad:^(NSArray *objects) {
                          self.locationObjects = objects;
                          [self.tableView reloadData];
                   } onError:^(NSError *error) {
                      NSLog(@"%@", error);
    }];

}

This code is in my viewDidLoad method of my UITableViewController class. It is the starting point for using RestKit to parse a JSON file from FourSquare. I was pulling my hair out because i couldn’t get the objects to show up in my Table View until i put [self.tableView reloadData];. With out that call the app never even hit my - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) because after the block was done executing locationObjects would be nil.

Before when I was debugging it the self.locationsObjects = objects worked when i was in the block (i am very unfamiliar with blocks by the way). As soon as i was out of the block the debugger would say locationObjects was nil, even though it had said it had 30 objects just like objects did when i had a break point at the assignment statement.

Can some one help me understand what is going on here.

Additional info:

Right now everything is working, or appears to be working my table is populated with the objects request from the JSON document. Originally I was doing this exact same thing in a normal ViewController and trying to set the objects from the block equal to locationObjects. Then using a prepareForSegue method i was trying to pass the locationObjects to the tableViewController in the standard method i have learned from numerous tutorials. I would get a SIGBAT error. The thread would terminate because of an unrecognized selector sent to the table view controller. Through debugging i would find that locationObjects could be nil in the prepareForSegue method. Here is the code from the viewController file.

Also I would get a warning here locationTableViewController.locationObjects = self.locationObjects; saying something about assigning a pointer of type NSArray to strong NSArray, or something like that ( i have since changed a lot attempting to get the code working and deleted some storyboard assets, so i’m not 100% sure of the wording).

@implementation CoffeeShopViewController

@synthesize venueCountLable = _venueCountLable;
@synthesize locationObjects = _locationObjects;

- (void)viewDidLoad
{
    [super viewDidLoad];
    [VenueManager searchNear:@"Orlando"
                      onLoad:^(NSArray *objects) {
                          self.venueCountLable.text = [NSString stringWithFormat:@"%d", objects.count];
                         self.locationObjects = objects;
    } onError:^(NSError *error) {
        NSLog(@"%@", error);
    }];

}

- (void)viewDidUnload
{
    [self setVenueCountLable:nil];
    [super viewDidUnload];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"locationTableSegue"])
    {
        LocationTableViewController *locationTableViewController = segue.destinationViewController;
        locationTableViewController.locationObjects = self.locationObjects;
    }
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

@end
  • 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-14T07:57:55+00:00Added an answer on June 14, 2026 at 7:57 am

    Try:

     @property (nonatomic, copy) NSArray *locationObjects;' 
    

    Edit on why this works:

    To be honest, I really don’t know the underlying reason for this to work and strong not working.
    When I saw the problem, it appeared to me that strong being equivalent of retain – inserting copy instead of strong could secure that locationObjects wouldn’t be nullified. Thinking again over it, I suspected that my assumption could be wrong – retain literally meant ‘Do not release this object because now there is one more guy holding it.’

    That, however, works somewhat differently. See this.

    What Malaxeur’s answer and comments below tells could possibly apply to NSArray in your example – despite strong ownership to locationObjects, what you are given is a reference to objects NSArray (an NSMutableArray*) instead of copy of it. Once out of scope (block end), it is no longer usable, and ARC claims it. Using copy in turn forces it to create another space in memory just for locationObjects, which would remain forever until you free it up.

    I still do not consider this a perfect explanation as I have never understood blocks fully. I would keep this open to everyone who knows better, would fill up as soon as I get something that’s useful.

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

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
My NSXMLParser breaks on this string: <title>AAA &#8211; BCDEFGQWERTYUIO</title> I parsed it in this
Welcome to Spring Roo. For assistance press CTRL+SPACE or type hint then hit ENTER.
When I view JSON data as an alert when the page loads, I see:
An extension to my previous question: Text cleaning and replacement: delete \n from a
I've got the following login script.. <?php $name = $_POST[name]; $password = $_POST[password]; $query
So to start, I have an array of XML files. These files need to
Here is the link to the offending page: http://www.wrightspecialty.com/brokers-agents-questionnaire.html?view=foxcontact There's a limitation to the
when i view my site : http://www.testtrack.tv/ in IE8's compatibility-mode the horizontal scrollpanes turn
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

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.