zoukankan      html  css  js  c++  java
  • 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 }

  • 相关阅读:
    CAD中的各种Polyline
    在CAD二次开发中使用状态条按钮
    在CAD二次开发中使用进度条
    EXSI6.5复制文件太慢的解决方法
    vlan交换机的端口模式有哪几种
    此计算机上的安全设置禁止访问其他域的数据源
    Could not write to output file 'c:WindowsMicrosoft.NET ASP.NET Filesxx' -- 'Access is denied
    添加现有文件夹到项目解决方案
    SSM-MyBatis-18:Mybatis中二级缓存和第三方Ehcache配置
    SSM-MyBatis-17:Mybatis中一级缓存(主要是一级缓存存在性的证明,增删改对一级缓存会造成什么影响)
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/11164260.html
Copyright © 2011-2022 走看看