我知道此类错误之前已多次提出,但我没有找到错误的解决方案。我正在使用xcode 4.0。我下载了ASIHTTPRequest zip和复制的classes文件夹以及两个'Reachability'文件。编译完成后,它给了我奇怪的错误,这是我无法弄清楚的。下面我为架构i386复制了未定义符号的错误文本。
Ld /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator/Manual.app/Manual normal i386
cd "/Users/svp/Desktop/Manual nav before pres 2"
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/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator -F/Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator -filelist /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Intermediates/Manual_BeforePres2.build/Debug-iphonesimulator/Manual.build/Objects-normal/i386/Manual.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lz -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator/Manual.app/Manual
Undefined symbols for architecture i386:
"_UTTypeCreatePreferredIdentifierForTag", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_UTTypeCopyPreferredTagWithClass", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassFilenameExtension", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassMIMEType", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
它还在 ASIAuthenticationDialog.m 文件中给我一个警告:
ASIAuthenticationDialog may not respond to _presentingViewController
请有人告诉我这些错误和警告是什么?我究竟做错了什么?我浪费了很多时间:(
修改
ASIAuthenticationDialog.m
文件中的警告代码:
#import "ASIAuthenticationDialog.h"
#import "ASIHTTPRequest.h"
#pragma mark show / dismiss
+ (void)dismiss
{
if ([sharedDialog respondsToSelector:@selector(presentingViewController)])
[[sharedDialog presentingViewController] dismissModalViewControllerAnimated:YES];
else
[[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
}
答案 0 :(得分:36)
如果您要查找文档中缺少的符号,您会发现它们与它们所在的框架一起列出。例如,UTTypeCreatePreferredIdentifierForTag
表示它位于MobileCoreServices.framework中。 (其他人也可能在那里;我没有找到所有这些。)将必要的框架添加到目标构建阶段的链接库步骤中,并且应该解析符号。
关于警告,请显示正在发生的代码。