子类化时“架构的重复符号”错误

时间:2014-05-05 00:17:20

标签: ios objective-c

我希望SearchCategoryChooserViewController成为SearchViewController的子类,并将其设置为:

SearchCategoryChooserViewController.h:

#import <UIKit/UIKit.h>
#import "SearchViewController.h"

@interface SearchCategoryChooserViewController : SearchViewController

@end

SearchViewController.h:

#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import <Parse/PFCloud.h>
#import "CriteriaViewController.h"



@interface SearchViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIButton *nextButtonOutlet;
@property (weak, nonatomic) NSString *topCategory1;
@property (weak, nonatomic) NSString *topCategory2;

@end

但是当我尝试运行应用程序时,它会给我以下错误:

    Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator/Parse+Storyboard.app/Parse+Storyboard normal i386
    cd /Users/Andrew/OneDrive/Dev/Parse---Storyboard
    export IPHONEOS_DEPLOYMENT_TARGET=7.1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator -F/Users/Andrew/OneDrive/Dev/Parse---Storyboard -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/Parse+Storyboard.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework AdSupport -framework Accounts -framework Social -framework SystemConfiguration -framework StoreKit -framework Security -framework QuartzCore -framework MobileCoreServices -lz -framework CoreLocation -framework CoreGraphics -framework CFNetwork -framework AudioToolbox -lsqlite3 -framework Parse -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/Parse+Storyboard_dependency_info.dat -o /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator/Parse+Storyboard.app/Parse+Storyboard

duplicate symbol _OBJC_IVAR_$_SearchViewController._nextButtonOutlet in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_IVAR_$_SearchViewController._topCategory1 in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_IVAR_$_SearchViewController._topCategory2 in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_IVAR_$_SearchViewController._itemSearch in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_IVAR_$_SearchViewController._nextButton in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_CLASS_$_SearchViewController in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
duplicate symbol _OBJC_METACLASS_$_SearchViewController in:
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchViewController.o
    /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/SearchCategoryChooserViewController.o
ld: 7 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

2 个答案:

答案 0 :(得分:8)

当你将#{1}}文件错误地导入项目而不是导入标题(.h)时,通常会发生这种情况。确保#import只有标题。

答案 1 :(得分:1)

您是否已将项目中的SearchViewControllerSearchCategoryChooserViewController文件移至其他位置并再次导入项目?确保删除以前的文件。