ManagedObject类由两个OS X目标共享。一个应用程序只有类重新定义错误。修复不需要重命名我的NSManagedObject?

时间:2014-10-15 16:16:30

标签: macos nsmanagedobject

错误:重新定义'类别'作为不同种类的符号

我有一个NSManagedObject类问题,我的类(类别)在基础中重新定义了一个类似乎,但基金会在同一个项目的两个应用程序中!

我的项目有两个目标,这两个Mac OS x应用程序共享一个DataModel和相关的Class。一个应用程序,即主应用程序,有望成为应用程序商店 另一个是一个实用程序应用程序,用于从XML生成一个sqlite数据库,以便与主应用程序一起发货。

主应用程序编译并运行。实用程序应用程序在此处稍稍抛出错误。 我在这个"重新定义"仅在实用程序应用程序中出现问题。重命名类别类别,是解决这个问题的方法,但事实 主要的应用程序编译和运行,告诉我,我可以通过寻找其他地方来解决它。 我希望这是足够的数据让别人告诉我在哪里看。 $(TARGET_NAME)== SqlFromXml_HM ==产品名称

问题实用程序具有:  0目标依赖项  11编译源  0链接二进制文件库  5复制捆绑资源


In file included from /Users/mbarron/Cocoa/iHungryMac386/SqliteFromXml_HM/AppDelegateSql.m:13:
/Users/mbarron/Cocoa/iHungryMac386/Classes/Category.h:14:12: error: redefinition of   'Category' as different kind of symbol
@interface Category : NSManagedObject {
           ^

In module 'Foundation' imported from /Users/mbarron/Cocoa/iHungryMac386/SqliteFromXml_HM/XmlListReader5.h:12:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In module 'os' imported from   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/dispatch/dispatch.h:48:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/os/object.h:74:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/objc/runtime.h:50:31: note: previous definition is here
typedef struct objc_category *Category;
                          ^
1 error generated.

Info.plist如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>com.DrummingGrouse.$(PRODUCT_NAME:rfc1034identifier)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSMinimumSystemVersion</key>
    <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
    <key>NSMainNibFile</key>
    <string>MainWindow</string>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
</dict>
</plist>

Category.h开始

//  Category.h

#import <CoreData/CoreData.h>
@class Recipe;

@interface Category : NSManagedObject {
  ...

}


非常感谢您阅读本文。标记

1 个答案:

答案 0 :(得分:0)

请勿拨打您的界面Category。该名称由ObjC运行时使用。

将其称为更具体的内容,例如RecipeCategory