Coredata Error Failed To Call Designated Initializer
Contents |
here for a quick overview of the site Help Center Detailed answers to any
Coredata Error Failed To Call Designated Initializer On Nsmanagedobject Class
questions you might have Meta Discuss the workings and policies coredata error failed to call designated initializer on nsmanagedobject class 'nsmanagedobject' of this site About Us Learn more about Stack Overflow the company Business Learn more about
Coredata Error Failed To Call Designated Initializer On Nsmanagedobject Class 'user'
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow coredata error failed to call designated initializer on nsmanagedobject is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Resolving 'Failed to call designated initializer on NSManagedObject class' up vote 5 down vote favorite I'm new to Swift and I'm trying to learn how to use Core Data. But coredata error failed to call designated initializer on nsmanagedobject class swift I'm getting this error and I'm not sure what I've done wrong. I've searched online and tried a few things but I can't get it right. Failed to call designated initializer on NSManagedObject class 'FirstCoreData.Course' When this line executes: ncvc.currentCourse = newCourse In this function: class TableViewController: UITableViewController, AddCourseViewControllerDelegate { var managedObjectContext = NSManagedObjectContext.init(concurrencyType: NSManagedObjectContextConcurrencyType.MainQueueConcurrencyType) override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "addCourse" { let ncvc = segue.destinationViewController as! NewCourseViewController ncvc.delegate = self let newCourse = NSEntityDescription.insertNewObjectForEntityForName("Course", inManagedObjectContext: self.managedObjectContext) as! Course ncvc.currentCourse = newCourse } } Class generated by "Create NSManagedObject Subclass..." for Course entity: import Foundation import CoreData class Course: NSManagedObject { // Insert code here to add functionality to your managed object subclass } And: import Foundation import CoreData extension Course { @NSManaged var title: String? @NSManaged var author: String? @NSManaged var releaseDate: NSDate? } core-data swift2 share|improve this question edited May 12 at 23:50 Dan Beaulieu 7,26364672 a
here for a quick overview of the site Help Center Detailed
Restkit Failed To Call Designated Initializer
answers to any questions you might have Meta Discuss the swift initializer nsmanagedobject workings and policies of this site About Us Learn more about Stack Overflow the
Swift Failed To Call Designated Initializer On Nsmanagedobject Class 'nsmanagedobject'
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join http://stackoverflow.com/questions/33301250/resolving-failed-to-call-designated-initializer-on-nsmanagedobject-class the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CoreData: error: Failed to call designated initializer on NSManagedObject class failing on create up vote 0 down vote favorite I have http://stackoverflow.com/questions/32308565/coredata-error-failed-to-call-designated-initializer-on-nsmanagedobject-class looked at other questions and tried their solutions but the error persists. Also, this is my first iOS project so please explain like I'm five >.< Ok, so I have a diary entry entity, looking like such: import Foundation import CoreData class DiaryEntry: NSManagedObject { @NSManaged var title: String @NSManaged var text: String @NSManaged var date: NSDate @NSManaged var extra: String @NSManaged var backup: NSNumber } as well, i have a DAO file like this (abridged) import Foundation import CoreData class coreDataDao : NSManagedObject, DiaryDAO{ func createEntry(title:String,text:String,date:NSDate,backup:NSNumber,extra:String){ let newItem = NSEntityDescription.insertNewObjectForEntityForName("DiaryEntry", inManagedObjectContext: self.managedObjectContext!) as! DiaryEntry newItem.title=title newItem.text=text newItem.date=date newItem.extra=extra newItem.backup=backup.integerValue } } and finally, called in my viewcontroller, i have this function: let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext func jTest(){ var dao = coreDataDao() dao.createEntry("a title",text:"some text", date: NSDate(), backup: 2, extra: "extras") } However when the code runs, I get the following error: My
here for a quick overview of the site Help Center Detailed answers to any questions http://stackoverflow.com/questions/28338244/coredata-error-failed-to-call-designated-initializer-on-nsmanagedobject-class you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers https://www.reddit.com/r/iOSProgramming/comments/38t358/failed_to_call_designated_initializer_on/ or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a failed to community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CoreData: error: Failed to call designated initializer on NSManagedObject class 'SCTrack' up vote 0 down vote favorite Hate to ask this question because there seems to be a bunch of other similar ones and failed to call but I still can't see what is wrong with mine after going through most of the answers. I have two VCs, VC1 contains a list of songs fetched from a music service. VC2 contains a list of songs picked from VC1; VC2 is basically a playlist. I've set up my entity name and class to match: SCTrack. Here is my SCTrack.h: @interface SCTrack : NSManagedObject @property (strong, nonatomic) NSString* title; @property (strong, nonatomic) NSString* stream_url; SCTrack.m: #import "SCTrack.h" @implementation SCTrack @dynamic title; @dynamic stream_url; -(instancetype) initWithDictionary: (NSDictionary*) SCTrackDict { self = [self init]; if (self) { self.title = SCTrackDict[@"title"]; self.stream_url = SCTrackDict[@"stream_url"]; } return self; } +(NSMutableArray *) parseJSONData: (NSData *) JSONData { NSError* error; NSMutableArray* SCTrackArray = [NSMutableArray new]; NSArray *JSONArray= [NSJSONSerialization JSONObjectWithData:JSONData options:0 error: &error]; if ([JSONArray isKindOfClass:[NSArray class]]) { for (NSDictionary* trackDict in JSONArray) { SCTrack* trackObject = [[SCTrack alloc]initWithDictionary:trackDict]; [SCTrackArray addObject:trackObject]; } } return SCTrackArray; } @end My AppDelegate.m UITabBarController* tabBar = (UITabBarController*) self.window.rootVi
»iOSProgrammingcommentsWant to join? Log in or sign up in seconds.|Englishlimit my search to /r/iOSProgramminguse the following search parameters to narrow your results:subreddit:subredditfind submissions in "subreddit"author:usernamefind submissions by "username"site:example.comfind submissions from "example.com"url:textsearch for "text" in urlselftext:textsearch for "text" in self post contentsself:yes (or self:no)include (or exclude) self postsnsfw:yes (or nsfw:no)include (or exclude) results marked as NSFWe.g. subreddit:aww site:imgur.com dogsee the search faq for details.advanced search: by author, subreddit...this post was submitted on 06 Jun 20150 points (50% upvoted)shortlink: remember mereset passwordloginSubmit a new linkSubmit a new text postiOSProgrammingsubscribeunsubscribe26,366 readers~28 users here nowJoin us on #subreddit channel at iOS-Developers.io on Slack! About A subreddit to share articles, code samples, open source projects and anything relating to iOS. There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there. If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you: Swift or Objective-C? if you don't know which language to choose. (New posts asking this will be removed) Related Subreddits /r/swift /r/ObjectiveC /r/ios /r/iPhone /r/tvOS /r/watchOS /r/macosprogramming Related Links The Swift Programming Language also available as an iBook - new Apple's programming language for writing iOS and OS X applications; Objective-C primer if you are new to the