Xcode8 1 创建coreData的ManagedObject后,报错 linker command failed with exit code 1
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的更多相关文章
- 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.引用出 ...
- 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 ...
- [问题]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一
今天添加了一个新类(包括m,h,xib文件),还没有调用,-编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...
- 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 ...
- [报错]编译报错:clang: error: linker command failed with exit code 1及duplicate symbol xxxx in错误解决方法之一
今天添加了一个新类(包括m,h,xib文件),还没有调用,—编译遇到如下错误,根据错误提示, duplicate symbol param1 in: /Users/xxxx/Library/Devel ...
- iOS开发——打包报错error: linker command failed with exit code 1
真机运行没问题,打包报错: clang: error: linker command failed with exit code 1 (use -v to see invocation) 原因:在Xc ...
- Xcode真机报错clang: error: linker command failed with exit code 1 (use -v to see invocation)
出现这种错误,如下图所示,搜索bitcode,置为NO即可.
- 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 ...
- pycharm报错:Process finished with exit code -1073741819 (0xC0000005)解决办法
这个是几个月前的问题了,有小伙伴在CSDN问我咋解决的,那我今天在这边把这个问题解决办法分享下吧,免得大家把很多时间都浪费在安装排坑上面,有些坑虽然解决了还真不知道啥原因. 我的pycharm一直用的 ...
随机推荐
- jvm 指令重排
引言:在Java中看似顺序的代码在JVM中,可能会出现编译器或者CPU对这些操作指令进行了重新排序:在特定情况下,指令重排将会给我们的程序带来不确定的结果..... 1. 什么是指令重排? 在计算机 ...
- ALV 颜色设置(行,列,单元格)
[转自:https://www.cnblogs.com/mingdashu/p/color_alv.html] BCALV_EDIT_03 http://blog.sina.com.cn/s/blog ...
- Spring Boot中一个Servlet主动断开连接的方法
主动断开连接,从而返回结果给客户端,并且能够继续执行剩余代码. 对于一个HttpServletResponse类型的对象response来说,执行如下代码: response.getWriter(). ...
- iOS-AVPlayer使用
1引入AVFoundation.framework框架 2引入头文件<AVFoundation/AVFoundation.h>,并拖入需要播放的视频文件 代码如下: 自定义播放的View, ...
- 图像Resize中0.5像素中心对齐的问题
目录 0.5像素对齐的问题 0.5像素对齐的问题 1. 问题提出 在进行图像缩放时,偶尔会看到一些比较奇怪的代码,其中有一个就是0.5像素中心对齐的问题,例如在OpenCV线性插值的代码中有类似如下操 ...
- PHP 7 错误处理 Error
前提:PHP 7 改变了大多数错误的报告方式.不同于 PHP 5 的传统错误报告机制,现在大多数错误被作为 Error 异常抛出. try { echo 2 % 0; // 错误: 分母为0 } ca ...
- OS计算题练习
一.进程同步 1.设有两个进程P.Q,P的优先级高于Q,同时进入就绪队列.各自运行的程序段如下所示: 进程P 进程Q P1 Y=12 Q1 X=18 P2 Y=A+Y Q2 A=X+A P3 ...
- 乐字节Java变量与数据类型之一:Java编程规范,关键字与标识符
大家好,我是乐字节的小乐,这次要给大家带来的是Java变量与数据类型.本文是第一集:Java编程规范,关键字与标识符. 一.编程规范 任何地方的名字都需要见名知意: 代码适当缩进 书写过程成对编程 对 ...
- “无法改变的设计”——浅谈Java中的final关键字
在Java中,final关键字可以用来修饰类.变量(包括成员变量和局部变量).方法,下面从这三个方面分别说明. final方法 当一个方法被final修饰时,表明这个方法不能被子类重写. 下面程序试图 ...
- 数组、可变参数 、this关键字 (札记)
Thinking in java 读书笔记(P84 ~ P104) 作者:淮左白衣 写于:2018年4月10日16:42:57 目录 this 为什么可以代表调用对象 数组 数组中的 length 定 ...