草庐IT

multi-context-coredata

全部标签

ios - 使用 Coredata Swift 发送到实例的无法识别的选择器

每当我尝试更新核心数据模型的值时,我都会收到此错误。这是我的模型importFoundationimportCoreData@objc(Habit)classHabit:NSManagedObject{@NSManagedvarname:String@NSManagedvartrackingType:NSNumber}这是我的代码tableViewCelloverridefuncsetSelected(selected:Bool,animated:Bool){super.setSelected(selected,animated:animated)ifselected{self.acc

ios - 错误: CoreData: warning: Unable to load class named '' for entity 'Receipt' . 但是类被删除了

我已经为我的实体创建了一个NSManagedObject的子类,但是在我删除它之后因为我不使用它,我只在我的xcdatamodeld文件中指定了实体。当我使用这个实体时,我现在在我的控制台中收到这条消息:CoreData:警告:无法为实体“Receipt”加载名为“”的类。找不到类,而是使用默认的NSManagedObject。!我怎样才能完全删除这个类,以便CoreData不再为我的实体研究一个类? 最佳答案 您很可能仍然让您的模型尝试访问该类。进入您的XCDataModel并确保所有实体的“类名”都设置为NSManagedObj

ios - Swift 中适用于 iOS 9 和 iOS 10 的 CoreData 堆栈

我正在尝试将CoreData添加到支持iOS9+的现有项目中。我添加了Xcode生成的代码://MARK:-CoreDatastacklazyvarpersistentContainer:NSPersistentContainer={letcontainer=NSPersistentContainer(name:"tempProjectForCoreData")container.loadPersistentStores(completionHandler:{(storeDescription,error)inifleterror=errorasNSError?{fatalError(

swift - 删除 NSAttributedString : "Type of expression is ambiguous without more context"

谁能告诉我哪里出了问题?letmyTitle=NSAttributedString(string:Xdevices[row].deviceName!,attributes:[NSFontAttributeName:UIFont(name:"Georgia",size:15.0)!,NSForegroundColorAttributeName:UIColor.orangeColor(),NSStrikethroughStyleAttributeName:NSUnderlineStyle.StyleSingle])错误是:Typeofexpressionisambiguouswithout

swift - 如何使用 Swift 在后台线程中保存到 CoreData?

我需要在后台线程中执行时将数据保存到CoreData。我发现了一些问题以及如何执行此操作的答案,但所有问题都与objective-c有关。也许有人会很友好地分享在Swift中在后台线程中保存数据的方法?我使用的代码如下overridefuncviewDidLoad(){dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0)){[unownedself]insaveArticlesListToDb("Specs")}}funcsaveArticlesListToDb(category:String){var

ios - swift : Create a multi-function multicast delegate

我想在事情发生变化时使用多播委托(delegate)来通知多个对象。我读过的解释这一点的教程有一个协议(protocol),该协议(protocol)只有一个直接在委托(delegate)数组上调用的函数。当只定义一个函数时,这很好用。我的协议(protocol)有6个功能。我想避免创建6个单独的函数并重用一个可应用于我的委托(delegate)数组的函数。简单示例:(我知道这是行不通的,但我只是想传达我的想法。protocolMyProtocol{funcmethod1()funcmethod2()funcmethod3()}classTestClass{vardelegates=[

swift 错误 : failed to get module 'My_App' from AST context

我使用的是Swift3、Xcode8.1、CocoaPods1.1.1。运行podupdate后,每次我尝试使用Xcode的lldb控制台-它都会打印错误。例如,poself输出:SharedSwiftstateforMyApphasdevelopedfatalerrorsandisbeingdiscarded.REPLdefinitionsandpersistentnames/typeswillbelost.warning:SwifterrorinmoduleMyApp.Debuginfofromthismodulewillbeunavailableinthedebugger.err

swift - 表节标题 : multi-line/word wrapping

我正在尝试制作一个表,其中的节标题可以是长字符串。我以为我的设置正确(动态行数,自动换行设置),但字符串只是在末尾被截断了。请注意,节标题的大小为80,在其他地方,这足以显示大约3行文本。//FormatsectionheaderoverridefunctableView(tableView:UITableView,willDisplayHeaderViewview:UIView,forSectionsection:Int){letheader:UITableViewHeaderFooterView=viewas!UITableViewHeaderFooterViewheader.co

ios - 如何将 NSAttributedString 保存到 CoreData

我想保存我的UItextview文本的attributedString。我试图转换为字符串并保存。但是当我返回设置text'attributedString时,它不起作用。这是我转换成字符串的方式:vara=String(stringInterpolationSegment:text.attributedText)Data.setValue(a,forKey:"font")Data.managedObjectContext?.save(nil)这是我返回设置的方式:text.attributedText=NSAttributedString(string:size)但我的TextVie

WoodScape: A multi-task, multi-camera fisheye dataset for autonomous driving

PapernameWoodScape:Amulti-task,multi-camerafisheyedatasetforautonomousdrivingPaperReadingNoteURL:https://openaccess.thecvf.com/content_ICCV_2019/papers/Yogamani_WoodScape_A_Multi-Task_Multi-Camera_Fisheye_Dataset_for_Autonomous_Driving_ICCV_2019_paper.pdfGITHUB_URL:https://github.com/valeoai/WoodSca