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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:32:39+00:00 2026-06-02T15:32:39+00:00

I have two additional columns on my PFUser firstName and lastName. They are saving

  • 0

I have two additional columns on my PFUser “firstName” and “lastName”. They are saving properly; I can see the data in the data browser.

I have another PFObject “class” that has a property with a NSArray of PFUsers. I use the class method +fetchAllIfNeededInBackground:block: on PFObject to fetch the array of PFUsers. In the callback block, I call objectForKey: on each of the PFUsers in the array, but I access them through the owning PFObject.

// invited is the NSArray of PFUsers
self.whoCell.mainLabel.text = [[self.plan.invited objectAtIndex:0] 
                                                  objectForKey:@"firstName"];

Debugger outputs this at a breakpoint right before the objectForKey call:

(lldb) po self.plan.invited
(NSArray *) $4 = 0x06e62a60 <__NSArrayM 0x6e62a60>(
<PFUser:GCCdPjCU2J> {
    firstName = Fake;
    lastName = Account;
    username = yyajnbafv53qw4yhjm9sfoiis;
}
)

Edit: adding implementation of self.plan.invited because the above is misleading.

- (NSArray*)invited
{
  // self.dataSource is a PFObject*
  return [self.dataSource objectForKey:INVITED_PROP];
}

Yet when the above call it made to objectForKey: this exception is thrown:

'NSInternalInconsistencyException', reason: 'Key "firstName" has no data.  Call fetchIfNeeded before getting its value.'

Edit: Accessing the array of fetchedObjects that is passed to the block callback for +fetchAllIfNeededInBackground doesn’t throw, but accessing the actual array that was originally passed to +fetchAllIfNeededInBackground throws.

Calling fetchIfNeeded before the call solves the problem, but why? The data is already there. Do I miss understand +fetchAllIfNeededInBackground in that it DOES NOT updated the PFObject that owns to collection of PFUsers?

  • 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-02T15:32:40+00:00Added an answer on June 2, 2026 at 3:32 pm

    I figured out what was happening. Let me explain with code:

    PFQuery *query = [PFQuery queryWithClassName:@"TestClass"];
    PFObject *testObj = [query getObjectWithId:@"xWMyZ4YEGZ"];
    
    // an array of PFUser "pointers" (pointers in Parse parlance)
    NSLog(@"%@", [testObj objectForKey:@"userArrayProp"]);
    [PFObject fetchAll:[testObj objectForKey:@"userArrayProp"]];
    
    // now userArrayProp contains fully fetched PFObjects
    NSLog(@"%@", [testObj objectForKey:@"userArrayProp"]);
    

    For me, after a certain amount of time userArrayProp would revert to an array of “pointers” and this mystified me. My problem was that calling refresh on a PFObject will revert a fetched array BACK to an array of pointers. Like this:

    PFQuery *query = [PFQuery queryWithClassName:@"TestClass"];
    PFObject *testObj = [query getObjectWithId:@"xWMyZ4YEGZ"];
    
    // an array of PFUser "pointers" (pointers in Parse parlance)
    NSLog(@"%@", [testObj objectForKey:@"userArrayProp"]);
    [PFObject fetchAll:[testObj objectForKey:@"userArrayProp"]];
    
    // now userArrayProp contains fully fetched PFObjects
    NSLog(@"%@", [testObj objectForKey:@"userArrayProp"]);
    
    [testObj refresh];
    
    // now userArrayProp contains pointers again :(
    NSLog(@"%@", [testObj objectForKey:@"userArrayProp"]);
    

    Wish it said that [PFObject refresh] did that in the documentation….

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

Sidebar

Related Questions

I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record
I have a two dimensional array, which represents columns and rows of data. I
I have a table with columns for ID , firstname , lastname , address
I have two columns of radio buttons and a dropdown for additional selection. Both
I have a very simple table with two string columns marked unique. Can anyone
I have two classes generated by LINQ2SQL both from the same table so they
I have two data access objects that are reverse generated and jar'ed up for
I have data from two spreadsheets where I need to compare the quantities of
I have a table with unique index on two columns, id_parent and sort_order to
I have a table with two columns [id, value] both numeric. In this example:

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.