Is it possible to fetch the number from the Z_PK column created by Core Data? If so, would you fetch this column the same way you would fetch attributes you created manuall
The z_pk is not an attribute that you can fetch like any other the other attributes. What you can do is to extract the z_pk value from the managedObjectID
of your entity
The managedObjectID can be obtained using [self objectID]
. For this example we take this one:
/p5>
The p5
at the end is the z_pk. (For this store, and for this entity, at at this time. It can change)
Not sure what you need the z_pk for, nor in what format. Let's convert the managedObjectID
into a string:
NSString *aString = [[[self objectID] URIRepresentation] absoluteString];
From the string extract the 5
:
NSArray *theComponents = [aString componentsSeparatedByString:@"/p"];
NSInteger theZpk = [[theComponents lastObject] intValue];
Now you have the z_pk as an int
and can process it as you like.