multithreading - CoreData: warning: Unable to load class named -


i duplicating existing objective-c tv show app new swift version using xcode 6.1 , having issues coredata.

i have created model of 4 entities, created nsmanagedobject subclass (in swift), , files have proper app targets set (for 'compile sources').

i still getting error whenever try insert new entity:

coredata: warning: unable load class named 'shows' entity 'shows'. class not found, using default nsmanagedobject instead.

a few comments:

when saving core data, use parent-child context way allow background threading. setting managedobjectcontext using:

lazy var managedobjectcontext: nsmanagedobjectcontext? = {   // returns managed object context application (which bound persistent store coordinator application.) property optional since there legitimate error conditions cause creation of context fail.   let coordinator = self.persistentstorecoordinator   if coordinator == nil {     return nil   }   var managedobjectcontext = nsmanagedobjectcontext(concurrencytype: nsmanagedobjectcontextconcurrencytype.mainqueueconcurrencytype)   managedobjectcontext.persistentstorecoordinator = coordinator   return managedobjectcontext }() 

and saving data using:

dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), { () -> void in   var context = nsmanagedobjectcontext(concurrencytype: nsmanagedobjectcontextconcurrencytype.privatequeueconcurrencytype)   context.parentcontext = self.managedobjectcontext!   ...rest of core data saving code here... }) 

this warning 1 of quirks have deal while details of swift implementation being ironed out. warning occurs spuriously, i.e. setup might work if not follow steps outlined below.

i have been able rid of in cases by making sure class set correctly in model editor. unlike in many other sof posts (including answers question), suggestion include module name (like myapp.shows) has not helped me.

make sure check these 3 items:

1.
version works xcode 7 beta 3

up xcode7 b3

notice corrected entity name more appropriate singular.

version works swift 2.0 in xcode 7.1
(should work xcode 7 beta 4 , above)

you need delete text "current product module" in module!

from xcode7 beta 3

2.
should follow frequent recommendation include

@objc(show) 

just above class.

note: if using xcode 7 beta 4 or later, step optional.

3.
make sure cast created managed object proper class, default nsmanagedobject.

var newshow = nsentitydescription.insertnewobjectforentityforname("show",                   inmanagedobjectcontext: context) show 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -