Re: Core Data entity name issue
Re: Core Data entity name issue
- Subject: Re: Core Data entity name issue
- From: Chuck Soper <email@hidden>
- Date: Mon, 02 Jul 2012 19:12:58 -0700
- Thread-topic: Core Data entity name issue
Juan and Robert, thanks. I think that I will adopt the following practice:
before generating NSManagedObject subclass source files, add a prefix to
the Entity class name by using the Data Model Entity inspector. When the
NSManagedObject subclass source files are generated, the class and entity
names will all be correct.
This practice should avoid these kind of compile and run time errors. I
was surprised that it took a couple of weeks for the errors to show up.
Chuck
On 7/2/12 4:22 PM, "Juan Fernandez" <email@hidden>
wrote:
>This problem can happen when using common names. I had a similar problem
>using "Message" as one of my core data entities. While there was no
>problem with the entity, the runtime was giving me problems with the
>class. The way I solved it was by changing the class name of my core data
>entity. In this case, might be convenient to change the class name with
>the project prefix and the entity name (this also will keep a consistent
>naming convention with other classes). Note that the entity name will
>stay the same, only the class name will change.
>On Jul 2, 2012, at 5:59 PM, Robert Tillyard wrote:
>
>> I had the same issue recently and had to change the name of my files to
>>Time_.m and Time_.h which solved the issue and left it at that.
>>
>> It seems that one of the files included by <Cocoa/Cocoa.h> is <Time.h>
>>but if you have one in your project it uses that instead.
>>
>> Regards, Rob.
>>
>> On 2 Jul 2012, at 21:33, Chuck Soper wrote:
>>
>>> I just found an issue with a Core Data entity named "Time"
>>>
>>> Here are steps to reproduce:
>>> 1. Using Xcode 4.3.3 on Mac OS X 10.7.4, create a new Project. Create a
>>> Cocoa Application with Core Data, ARC, Unit Tests and a Spotlight
>>>Importer.
>>> 2. Build it to confirm that there are no errors.
>>> 3. Add an entity named "Time" to the data model.
>>> 4. Create source for the "Time" entity. Here's how I created source:
>>>
>>><http://developer.apple.com/library/mac/#recipes/xcode_help-core_data_mo
>>>del
>>> ing_tool/Articles/creating_mo_class.html>
>>> 5. Now, build again and you should get 37 errors! The errors are mainly
>>> parse issues. Here's a small sample of the errors reported for
>>> NSObjCRuntime.h:
>>> Parse Issue: Expected identifier or '('
>>> Parse Issue: Unknown type name 'NSString'
>>> Parse Issue: Unknown type name 'Protocol'
>>> Semantic Issue: Format argument not an NSString
>>>
>>> To fix the problem, one can remove Time.m and Time.h from the project.
>>>Or,
>>> I assume avoiding Entities name "Time" would also work.
>>>
>>> During WWDC week, I created a Core Data project (using the same as the
>>> steps above) and added Time.m and Time.h source to access the entity.
>>> There were no problems until today. The only difference is that my SSD
>>> startup disk crashed and now I'm using a SATA startup disk from a
>>>Carbon
>>> Copy Cloner backup.
>>>
>>> Any thoughts on this? Can anyone reproduce the steps I've outlined?
>>>
>>> Thanks,
>>> Chuck
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>>com
>>>
>>> This email sent to email@hidden
>>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>>email@hidden
>>
>> This email sent to email@hidden
>
>Juan Fernandez
>email@hidden
>
>
>
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Xcode-users mailing list (email@hidden)
>Help/Unsubscribe/Update your Subscription:
>
>This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden