Xcode8 1 创建coreData的ManagedObject后,报错

使用Xcode 8.1 创建coreData的ManagedObject后,报错。 duplicate symbol OBJC_CLASS$_ClassName in: .../ClassName+CoreDataClass.o duplicate symbol OBJC_METACLASS$_ClassName in: .../ClassName+CoreDataClass.o ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 解决方法为,将

 然后修改ClassName+CoreDataClass.h和ClassName+CoreDataClass.m为ClassName.h和ClassName.m。 注意在ClassName+CoreDataProperties.h中系统给你创建的引用也要记得修改。 备注:下面为三种Codegen的区别,来自XCode 8 generates broken NSManagedObject subclasses for iOS 10 Option 1: "Class Definition" Think of this as the "plug and play" option Use the model editor to create the entities and associated attributes that you want Core Data to manage. Do not use the NSMangagedObject subclass generator. The required files are automatically generated for you by Xcode (however they do not show up in your project navigator). If you do generate the NSManagedObject files, Apple tells you that these files should not be edited in the header comments of said files. If you do need to edit these files, then this is good sign that you need to use another Codegen option. Leave the default Class options for your entity (Module = Global Namespace and Codegen = Class Definition) If you need to override methods of the NSManagedObject, you can create an extension using the Name under the Class option. // Optional extension in Entity.swiftextension Entity { // Override NSManagedObject methods }

Options 2: "Manual/None" Similar to Option 1, except that you can see and edit the NSManagedObject subclass files. Use the model editor to create the entities and associated attributes that you want Core Data to manage. Before using the NSManagedObject subclass generator, set the Codgen option to "Manual/None" for the entity. The Module option should be Global Namespace. After you add/remove/update an attribute, you have two choices: (1) Manually update the NSManagedObject files that were generated for you OR (2) Use the NSManagedObject subclass generator again (this will only update the Entity+CoreDataProperties.swift file). Again, if you need to override and methods from NSManagedObject, you can create an extension. The extension should be created in the Entity+CoreDataClass.swift file and not the Entity+CoreDataProperties.swift file (this file could be updated due to model editor changes). // Optional extension in Entity+CoreDataClass.swiftextension Entity { // Override NSManagedObject methods }

Option 3: "Category/Extension" Use this option if you have custom properties that do not need to be managed by Core Data. Use the model editor to create the entities and associated attributes that you want Core Data to manage. Ensure the Module option is set to Current Product Module and the Codegen option is set to "Category/Extension". Create your own NSManagedObject subclass with the properties that you will self manage. Do not use the NSMangagedObject subclass generator. The required files are automatically generated for you by Xcode (however they do not show up in your project navigator). // Subclass NSManagedObject in Entity.swiftclass Entity: NSManagedObject { // Self managed properties } // Optional extension in Entity.swiftextension Entity { // Override NSManagedObject methods }

Xcode8 1 创建coreData的ManagedObject后,报错 linker command failed with exit code 1的更多相关文章

  1. iOS 报错: linker command failed with exit code 1 (use -v to see invocation) 原因

    在iOS开发中,很多人会遇到这样的报错 linker command failed with exit code 1 (use -v to see invocation) 可能的原因如下: 1.引用出 ...

  2. HandyJSON.Metadata.Class Xcode10.2, swift5.0 报错 linker command failed with exit code 1

    https://blog.csdn.net/weiwandaixu_/article/details/88842491 2019年03月27日 13:35:40 一如初夏丿 阅读数:31 标签: li ...

  3. [问题]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一

    今天添加了一个新类(包括m,h,xib文件),还没有调用,-编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...

  4. iOS报错:linker command failed with exit code 1 (use -v to see invocation) 问题解决方式之一

    百度库原版本:3.2.1  更新为:4.2.0,两个库相隔2年时间: 问题i: 更新CocoaPods的同时更新了百度地图库的版本,运行程序报错: linker command failed with ...

  5. [报错]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一

    今天添加了一个新类(包括m,h,xib文件),还没有调用,—编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...

  6. iOS开发——打包报错error: linker command failed with exit code 1

    真机运行没问题,打包报错: clang: error: linker command failed with exit code 1 (use -v to see invocation) 原因:在Xc ...

  7. Xcode真机报错clang: error: linker command failed with exit code 1 (use -v to see invocation)

    出现这种错误,如下图所示,搜索bitcode,置为NO即可.

  8. mac M1通过homebrew安装python3报错Error: Command failed with exit 128: git

    fatal: not in a git directoryError: Command failed with exit 128: git 只需要运行 git config --global --ad ...

  9. pycharm报错:Process finished with exit code -1073741819 (0xC0000005)解决办法

    这个是几个月前的问题了,有小伙伴在CSDN问我咋解决的,那我今天在这边把这个问题解决办法分享下吧,免得大家把很多时间都浪费在安装排坑上面,有些坑虽然解决了还真不知道啥原因. 我的pycharm一直用的 ...

随机推荐

  1. osg fbx 模型树结构

    void Test::printOsgGroup(osg::ref_ptr<osg::Group> &groupParam) { qDebug() <<groupPar ...

  2. Linux 下kafka集群搭建

    主机的IP地址: 主机IP地址 zookeeper kafka10.19.85.149 myid=1 broker.id=110.19.15.103 myid=2 broker.id=210.19.1 ...

  3. MOQ中CallBase的作用

    当使用Moq来Mock一个具体的类,类里的方法为virtual时,Moq会将当前类,所有的virtual方法默认重写成空实现. 如果我们想要访问真实的代码,有两种方法 1.在创建Mock时,设置Cal ...

  4. Python----数据预处理代码实例

    为方便收藏学习,转载自:https://www.jb51.net/article/158168.htm 本文实例为大家分享了Python数据预处理的具体代码,供大家参考,具体内容如下 1.导入标准库 ...

  5. vue 强制组件重新渲染

    参考链接:https://blog.csdn.net/zyx1303031629/article/details/86656785

  6. 解决Maven依赖本地仓库eclipse报错的问题

    一.应用场景 有时候项目报红色的感叹号错误也是由于项目中没有导入相关jar报导致报错 为了使用maven强大的包依赖管理和项目管理功能,故在项目中使用maven2作为项目建构工具. 但是我的项目在内网 ...

  7. 《Tsinghua oc mooc》第8~10讲 虚拟内存管理

    资源 OS2018Spring课程资料首页 uCore OS在线实验指导书 ucore实验基准源代码 MOOC OS习题集 OS课堂练习 Piazza问答平台 暂时无法注册 第八讲 虚拟内存概念 为什 ...

  8. PCL学习(四)点云转换为网格

    Remove needless points compute normals surface reconstruction get texture(param 4096 basic) save pro ...

  9. 解决RabbitMQ消息丢失问题和保证消息可靠性(一)

    原文链接(作者一个人):https://juejin.im/post/5d468591f265da03b810427e 工作中经常用到消息中间件来解决系统间的解耦问题或者高并发消峰问题,但是消息的可靠 ...

  10. Java 最常见 200+ 面试题 + 全解析

    本文分为十九个模块,分别是: Java 基础.容器.多线程.反射.对象拷贝.Java Web .异常.网络.设计模式.Spring/Spring MVC.Spring Boot/Spring Clou ...