I have an Order which has a "to-many" relationship with Units. When I try to log the units (NSSet) in Order, I get a fault error:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Order"
inManagedObjectContext:mainContext];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [mainContext executeFetchRequest:fetchRequest
error:nil];
for (Order *order in fetchedObjects) {
NSLog(@"%@", [order units]);
break;
}
[fetchRequest release];
results in:
Relationship 'units' fault on managed object (0x6d9dd00) <Order: 0x6d9dd00> (entity: Order; id: 0x6d88e40 <x-coredata://97A3F3D5-ABA7-499A-A460-5E25CF49C528/Order/p1> ; data: {
composition = Hemlock;
condition = "";
consignee = "";
consigneeCompanyName = "";
contactAlternatePhone = "";
contactEmail = "";
contactFirstName = "";
contactLastName = "";
contactPhone = "";
customer = "Havard Empire";
customerCompanyName = "";
customerNotes = "";
dateDue = "1/13/2012 12:00:00 AM";
dateEntered = "1/6/2012 12:00:00 AM";
dateOrdered = "1/6/2012 12:00:00 AM";
deliveryAddress1 = "";
deliveryAddress2 = "";
deliveryCity = "";
deliverySpecialInstructions = "";
deliveryState = "";
deliveryZip = "";
depth = 01;
detail = "";
freightRate = "";
grade = Cull;
instructionsDirectionsNotes = "";
lastUpdated = "1/6/2012 3:00:43 PM";
length = 01;
location = "Lucedale, ms";
matsPerLoad = "";
memoLineNotes = "";
notes = "";
orderID = 201205134922479;
orderNumber = 01062012;
pUP = Cable;
pricePerItem = "";
purchaseOrderNumber = "";
pushToQuickBooks = True;
quantity = 0;
quickbooksCompany = 1;
salesman = "Accounting Adj";
separateRate = False;
taxRate = "";
totalLoads = "";
type = "2ply Mat";
units = "<relationship fault: 0x6dacf20 'units'>";
vendorID = 10;
width = 01;
})
The units aren't printed. It says "<relationship fault: 0x6dacf20 'units'>";
Also, why is it printing the entire object when I only want units?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…