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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:27:25+00:00 2026-05-15T09:27:25+00:00

I don’t understand the output of NSLog for the array returned by a NSFetchRequest.

  • 0

I don’t understand the output of NSLog for the array returned by a NSFetchRequest.

I’m reading my database and placing the contents in an array, looping through the array and then outputting the contents with NSLog. I don’t quite understand the output in the log file. Code below:

-(void)createXMLFeed{
    //Fetch details from the database.
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Tabrss" inManagedObjectContext:managedObjectContext];
    [request setEntity:entity];
    NSError *error;
    self.stories = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
    //[request release];

    // Count the number of items in the array and display in the log.
    int arrayItemQuantity = [stories count];
    NSLog(@"Array Quantity: %d", arrayItemQuantity);

    // Loop through the array and display the contents.
    int i;
    for (i = 0; i < arrayItemQuantity; i++)
        NSLog (@"Element %i = %@", i, [stories objectAtIndex: i]);

    [stories release]; 

    // Update log file.
    NSLog(@"Database read and XML feed created.");
}

Log file contents:

2010-06-24 10:09:56.918 TAB RSS[998:207] Array Quantity: 15
2010-06-24 10:09:56.919 TAB RSS[998:207] Element 0 = <NSManagedObject: 0x3b3dcb0> (entity: Tabrss; id: 0x3b06a60 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p22> ; data: <fault>)
2010-06-24 10:09:56.920 TAB RSS[998:207] Element 1 = <NSManagedObject: 0x3b3e1c0> (entity: Tabrss; id: 0x3b14720 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p23> ; data: <fault>)
2010-06-24 10:09:56.920 TAB RSS[998:207] Element 2 = <NSManagedObject: 0x3b3e370> (entity: Tabrss; id: 0x3b1ebd0 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p24> ; data: <fault>)
2010-06-24 10:09:56.921 TAB RSS[998:207] Element 3 = <NSManagedObject: 0x3b3e4e0> (entity: Tabrss; id: 0x3b1ecd0 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p25> ; data: <fault>)
2010-06-24 10:09:56.921 TAB RSS[998:207] Element 4 = <NSManagedObject: 0x3b3e660> (entity: Tabrss; id: 0x3b3b3f0 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p26> ; data: <fault>)
2010-06-24 10:09:56.922 TAB RSS[998:207] Element 5 = <NSManagedObject: 0x3b3e7d0> (entity: Tabrss; id: 0x3b09d20 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p27> ; data: <fault>)
2010-06-24 10:09:56.922 TAB RSS[998:207] Element 6 = <NSManagedObject: 0x3b3e940> (entity: Tabrss; id: 0x3b3cf20 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p28> ; data: <fault>)
2010-06-24 10:09:56.924 TAB RSS[998:207] Element 7 = <NSManagedObject: 0x3b3eac0> (entity: Tabrss; id: 0x3b3cf30 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p29> ; data: <fault>)
2010-06-24 10:09:56.924 TAB RSS[998:207] Element 8 = <NSManagedObject: 0x3b3ec40> (entity: Tabrss; id: 0x3b3cf40 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p30> ; data: <fault>)
2010-06-24 10:09:56.925 TAB RSS[998:207] Element 9 = <NSManagedObject: 0x3b3edb0> (entity: Tabrss; id: 0x3b3cf50 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p31> ; data: <fault>)
2010-06-24 10:09:56.925 TAB RSS[998:207] Element 10 = <NSManagedObject: 0x3b3ef20> (entity: Tabrss; id: 0x3b3cf60 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p32> ; data: <fault>)
2010-06-24 10:09:56.926 TAB RSS[998:207] Element 11 = <NSManagedObject: 0x3b3f090> (entity: Tabrss; id: 0x3b3cf70 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p33> ; data: <fault>)
2010-06-24 10:09:56.926 TAB RSS[998:207] Element 12 = <NSManagedObject: 0x3b3f200> (entity: Tabrss; id: 0x3b3cf80 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p34> ; data: <fault>)
2010-06-24 10:09:56.927 TAB RSS[998:207] Element 13 = <NSManagedObject: 0x3b3f380> (entity: Tabrss; id: 0x3b3cf90 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p35> ; data: <fault>)
2010-06-24 10:09:56.927 TAB RSS[998:207] Element 14 = <NSManagedObject: 0x3b3f500> (entity: Tabrss; id: 0x3b3cfa0 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p36> ; data: <fault>)
(gdb) continue
2010-06-24 10:09:57.932 TAB RSS[998:207] Database read and XML feed created.

What does this mean?:

<NSManagedObject: 0x3b3dcb0> (entity: Tabrss; id: 0x3b06a60 <x-coredata://5B703215-A7D8-4E42-834E-A721D78E84BE/Tabrss/p22> ; data: <fault> 

I want to actually see the contents of the field from the database.

I have 15 records in my database and 12 fields in each record. From my basic understanding, it looks like my stories array is holding the entire record from the database and not the individual fields. Maybe I need a 2D array to accomplish this, if so, how do I go about doing that?

Ultimately I want to loop through the array and create XML tags for each field. But one step at a time…

Thanks in advance, Stephen

  • 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-15T09:27:26+00:00Added an answer on May 15, 2026 at 9:27 am

    To view the individual fields of the objects in the array you must reference them directly. You are using this to show the objects in the array:

    NSLog (@"Element %i = %@", i, [stories objectAtIndex: i]);
    

    NSLog generates a description of each object when you use %@, which is often convoluted or useless. If you want to see the fields inside try something like this:

    NSLog (@"Element %i contains fields: %d - %s - %d",i,[[stories objectAtIndex: i] getIntegerField],[[stories objectAtIndex: i] getStringField],[[stories objectAtIndex: i] getAnotherIntegerField]);
    

    The values displayed will be the values returned by the getter functions of each object you are referencing in stories.

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

Sidebar

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.