CoreData & temporary oid (REPOST)
CoreData & temporary oid (REPOST)
- Subject: CoreData & temporary oid (REPOST)
- From: Benjámin Salánki <email@hidden>
- Date: Mon, 9 Oct 2006 22:10:19 +0200
Dear list, since I received no answer, I try again, maybe it just
slipped through the last time. I'm really lost here...
Hi,
I have a CoreData application that when a new volume is mounted
iterates through its file and folder structure and creates an entity
for each item, thus the contents can be represented as a browsable
data source in an outline view.
Now sometimes, but not always, when a volume with lots of files (read
around 2000) is cataloged, during the saveAction: method I get an
error saying:
2006-10-06 21:04:03.205 Project Felix[25325] An uncaught exception
was raised
2006-10-06 21:04:03.206 Project Felix[25325] cannot find data for a
temporary oid: 0x9df5ca0 <x-coredata:///item/tB3EBF04F-57F1-42A4-9622-
C0010EC3A2F0>
2006-10-06 21:04:03.206 Project Felix[25325] *** Uncaught exception:
<NSInternalInconsistencyException> cannot find data for a temporary
oid: 0x9df5ca0 <x-coredata:///item/tB3EBF04F-57F1-42A4-9622-
C0010EC3A2F0>
So I decided to iterate through all my entities before sending the
save: message, and I find one:
2006-10-06 21:04:00.791 Project Felix[25325] <SFManagedObject:
0x66d4390> (entity: item; id: 0x6a432c0 <x-coredata:///item/
t3EA71ADC-5555-44A3-B67A-B30C565DBF2C> ; data: {
children = (
0x11dee990 <x-coredata:///item/
t8CD7C856-660B-4855-80FB-88F92FB6561D>,
0x6a7af30 <x-coredata:///item/
t36246A0D-24CA-4744-981D-1A46AF0A904C>,
0x119c1500 <x-coredata:///item/
t7937E668-02B3-44DC-93D0-7E39D451FA95>,
0x39a960 <x-coredata:///item/t8028773C-587E-4397-A427-
B138581BF9C8>,
0x119ee8e0 <x-coredata:///item/t7BD45C42-0662-46CE-880A-
D1CB1061F55E>,
0x6a7b9d0 <x-coredata:///item/t404FE2A3-
D3E1-485E-803A-782206817C82>,
0x11f1bae0 <x-coredata:///item/tE0A3D964-03AB-4A89-A210-
E77DA3048FA4>
);
creation = 2005-01-16 17:43:15 +0100;
folderCount = 7;
icon = <4d4d002a 00002408 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 0000>;
id = 0;
isFolder = 1;
isVolume = 1;
kind = nil;
modification = 2005-01-16 17:43:15 +0100;
note = nil;
parent = nil;
size = 4668111111;
title = "stupidFish DVD 7";
})
Now notice, that the managed object I find during the iteration
<SFManagedObject: 0x66d4390> does not match the oid that is mentioned
during the crash (0x9df5ca0).
Furthermore I read through the docs and found this (from http://
developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/
cdTroubleshooting.html):
Problem: You add an object to a context. When you try to save the
document you get an error that looks like this:
[date] My App[2529:4b03] cannot find data for a temporary oid:
0x60797a0 <<x-coredata:///MyClass/t8BB18D3A-0495-4BBE-840F-
AF0D92E549FA195>x-coredata:///MyClass/t8BB18D3A-0495-4BBE-840F-
AF0D92E549FA195>
Cause: You may have forced a newly inserted object to "lose" its
inserted status and then changed or deleted it. This could happen if
you passed a temporary object ID to objectWithID:. You may have
passed an inserted object to another managed object context.
Remedy: There are a number of possible remedies, depending on what
was the root cause:
Do not pass an inserted (not yet saved) object to another context.
Only objects that have been saved can be passed between contexts.
Do not invoke refreshObject: on a newly-inserted object.
Do not make a relationship to an object that you never insert into
the context.
Ensure that you use the designated initializer for instances of
NSManagedObject.
Now to all my knowledge none of these items are the cause of my
problem, so I can not apply these remedies.
I tried saving the ManagedObjectContext after each folder was
finished, but since the items have relationships that are not
resolved before I finish all the iterations I get all sorts of errors
and eventual crashes if I go that way.
Any ideas on where to start are appreciated.
Thanks,
Ben
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden