私はユニットと「多対多の」関係を持つオーダーを持っています。私が注文に単位(NSSet)をログに記録しようとすると、私は、障害のエラーが表示されます。CoreDataリレーションシップフォルト?
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];
結果で:ユニットは印刷されません
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;
})
。それは"<relationship fault: 0x6dacf20 'units'>";
また、私はユニットが欲しいときにオブジェクト全体を印刷している理由は何ですか?
おかげで、それは動作しません。私はこれを前に試しました。 – 0xSina
このようにすると、ログには何が表示されますか? – sosborn
何もありません。 2番目のループを反復しません。私は数をチェックし、ゼロを返します。 – 0xSina