开发者

NSManagedObject Core Data - request for member 'attribute name' in something not a structure or union

Scenario:

I created a xcode project called "Importing" which I read an XML file in and import content into my core data database. I then have a second "main" project where I add the SQLite file into the main bundle and import using the code from Core Data Books example. I made changes to the .xcodedatamodel in my "importing" project I revealed that in finder and dragged it into my "main" project then generate the NSManagedObject m开发者_JAVA技巧odel files there. Until now this has work but Xcode seems to be confused...

Recently I deleted some Attributes and added 1 new one. I then did the same process as above and now it says "request for member 'attribute name' in something not a structure or union". If I type article 'modelname.' and press esc the intellisence is still picking up the old attributes?

In the "importing" project though everything is working fine and I do not get any errors on any attributes and the intellisence is correct?

Please advice, is there a cache in xcode? I have used "Clean all targets" but this does not seem to work.

James


Did you changed the properties in your custom NSManagedObject subclass?
Sounds like you forgot to do that.

Did you do a search in the whole project for your attribute name? If I had to make a guess I would say it is declared somewhere.


After making changes to xcdatamodel you need to do the following so try this

select your .xcdatamodel file.Then,

Step-1:

Go to Design -> Data Model -> Add Model Version

Step-2:

Go to Design -> Data Model -> Set Current Version

Now in "Set Current Version" you will get the latest one working for you.

Compile and Run. :]

Hope this helps.


Fixed it this morning.

After taking fluchtpunkt's tip to do a search in project I used finder to search for one of the old attribute names and one of the NSManagedObject class files still appeared in the "Classes" folder. The one in xcode was outside the classes folder and had the correct attributes but even though xcode did not have a reference to the old file in the "classes" directory it was still using it... So deleted it and now it is working!

Bloody xcode and file references and groups - wish there was an alternative!

Thanks for all the ideas!

James

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜