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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:57:51+00:00 2026-05-23T14:57:51+00:00

I have the following method in my UITableViewController subclass: -(void)populateDataStorage{ NSString *path = [[NSBundle

  • 0

I have the following method in my UITableViewController subclass:

-(void)populateDataStorage{

NSString *path = [[NSBundle mainBundle] pathForResource:@"FakeData" ofType:@"plist"];

if(path){
    NSArray *plistData = [[NSArray alloc] initWithContentsOfFile:path];
    NSEnumerator *enumerator = [plistData objectEnumerator];

    NSArray *personResults;

    Photo *photo;
    Person *person;

    id currItem = [enumerator nextObject];

    while (currItem != nil) {
        photo = (Photo *)[NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext: [[FlickrFetcher sharedInstance] managedObjectContext]];

        photo.name = [currItem objectForKey:@"name"];
        photo.path = [currItem objectForKey:@"path"];

        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name = %@", [currItem objectForKey:@"user"]];

        personResults = [[FlickrFetcher sharedInstance] fetchManagedObjectsForEntity:@"Person" withPredicate:predicate];

        if ([personResults count] > 0) {
            person = [personResults objectAtIndex:0];
        } 
        else {
            person = (Person *)[NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[[FlickrFetcher sharedInstance] managedObjectContext]];
            person.name = [currItem objectForKey:@"user"];
        }

        photo.person = person;
        [person addPhotosObject:photo];

        NSLog(@"Photo %@ added for user %@", photo.name, person.name);

        currItem = [enumerator nextObject];
    }

    [plistData release];
}

}

And I call it in my apps didFinishLaunchingWithOptions method in my AppDelegate, the method is also in the same AppDelegate, when it’s called I get the error it says there when debugging, if I don’t debug the line it will run the method and load with no problem. If I don’t debug at all it will not call the method.

EDIT: Changed the code according to the answer the problem still remains the same, if I just run nothing happens but when debugging I get the error. When I debug the whole method no error is shown.

  • 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-23T14:57:52+00:00Added an answer on May 23, 2026 at 2:57 pm

    Your call to NSLog is trying to access the name property of your person variable. However, when you declared your person variable, you didn’t initialize it, so it points to garbage. You only give it a valid value in your else clause, so sometimes your NSLog is accessing an uninitialized object.

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

Sidebar

Related Questions

I have overwritten my UITableViewController didSelectRowAtIndexPath method the following way: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
Hey - I have the following method on my UITableView controller public void RemoveEventFromList(Event
I have the following method public static void SerializeToXMLFile(Object obj,Type type, string fileName) {
i have the following method in a usercontrol protected override void Render(HtmlTextWriter writer) {
I have following simple method in my main activity. private void showMap(String name )
I have following method in my Borland C++ code, static bool UploadBitstream(void) { //Some
I have following method in the c code. void add(int number) { Node node1;
I have the following method signature: public void MyFunction(Object[,] obj) I create this object:
I have a following method private void SetProcessDocumentStatus(string status) { var setStatusWith = new
I have the following method: static Random rr = new Random(); static void DoAction(Action

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.