我是Xcode开发的新手,最近在我的项目开发过程中发现了一些奇怪的情况,只是想知道如果有人可以帮我解决这个问题,下面是我在尝试构建/运行时遇到的错误:
Ld /Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator/ACE.app/ACE normal i386
cd /Users/ACE/Documents/Development/Products/ACE4
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator -L/Users/ACE/Documents/Development/Products/ACE4/Classes/SUP/libs/Debug-iphonesimulator -F/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator -filelist "/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Intermediates/ACE.build/Debug-iphonesimulator/ACE Simulator.build/Objects-normal/i386/ACE.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40200 -lz.1.2.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AddressBook -framework CoreFoundation -framework QuartzCore -framework Security -lstdc++ -licucore.A -lclientrt -lMO -lSUPObj -framework MapKit -o /Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator/ACE.app/ACE
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_TransportMAPView", referenced from:
objc-class-ref in TransportViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
当我尝试使用我的自定义类(UIViewController的子类)
创建对象时,总会出现此错误CustomViewController *customView = [[CustomViewController alloc] init];
奇怪的是,如果我直接使用UIViewController
,错误就会消失并完美运行UIViewController *customView = [[UIViewController alloc] init];
当我使用UIButton中的自定义类时,下面是另一个错误:
Ld /Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator/ACE.app/ACE normal i386
cd /Users/ACE/Documents/Development/Products/ACE4
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator -L/Users/ACE/Documents/Development/Products/ACE4/Classes/SUP/libs/Debug-iphonesimulator -F/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator -filelist "/Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Intermediates/ACE.build/Debug-iphonesimulator/ACE Simulator.build/Objects-normal/i386/ACE.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40200 -lz.1.2.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AddressBook -framework CoreFoundation -framework QuartzCore -framework Security -lstdc++ -licucore.A -lclientrt -lMO -lSUPObj -framework MapKit -o /Users/ACE/Library/Developer/Xcode/DerivedData/ACE-ayqohtkcbgquxjgnnsbnwcketmir/Build/Products/Debug-iphonesimulator/ACE.app/ACE
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AceButton", referenced from:
objc-class-ref in TransportViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我的自定义类:
#import <UIKit/UIKit.h>
@interface AceButton : UIButton{
NSString *identifier;
}
@property(nonatomic,retain) NSString *identifier;
@end
在我的一个View Controller方法viewDidLoad()
中AceButton *button1 = [[AceButton alloc] initWithFrame:frame];
答案 0 :(得分:1)
错误消息基本上表示类TransportViewController
使用类TransportMAPView
,但链接器找不到类TransportMAPView
(在构建过程结束时,它结合了所有类)将代码编译成单个可执行文件)。
类TransportViewController
和TransportMAPView
是您的代码的一部分吗?如果TransportMAPView
应该在库中,那么库就没有正确添加。