2012-10-22 31 views
3

我已经添加了这些文件到我的项目:使用ASIHTTPRequest与项目,该项目采用ARC

ASICacheDelegate.h 
ASIDataCompressor.h 
ASIDataCompressor.m 
ASIDataDecompressor.h 
ASIDataDecompressor.m 
ASIDownloadCache.h 
ASIDownloadCache.m 
ASIFormDataRequest.h 
ASIFormDataRequest.m 
ASIHTTPRequest.h 
ASIHTTPRequest.m 
ASIHTTPRequestConfig.h 
ASIHTTPRequestDelegate.h 
ASIInputStream.h 
ASIInputStream.m 
ASINetworkQueue.h 
ASINetworkQueue.m 
ASIProgressDelegate.h 

然后在项目的构建阶段加入-fno-objc-arc,因为我的项目是使用ARC和ASIHTTPRequest不使用它写。当我尝试编译项目中,我得到这些错误:

Undefined symbols for architecture x86_64: 
    "_SCDynamicStoreCopyProxies", referenced from: 
     -[ASIHTTPRequest configureProxies] in ASIHTTPRequest.o 
    "_deflate", referenced from: 
     -[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o 
    "_deflateEnd", referenced from: 
     -[ASIDataCompressor closeStream] in ASIDataCompressor.o 
    "_deflateInit2_", referenced from: 
     -[ASIDataCompressor setupStream] in ASIDataCompressor.o 
    "_inflate", referenced from: 
     -[ASIDataDecompressor uncompressBytes:length:error:] in ASIDataDecompressor.o 
    "_inflateEnd", referenced from: 
     -[ASIDataDecompressor closeStream] in ASIDataDecompressor.o 
    "_inflateInit2_", referenced from: 
     -[ASIDataDecompressor setupStream] in ASIDataDecompressor.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我所试图做ASIHTTPRequest:

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/me/photos?access_token=%@", access_token]]; 
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; 
[request addFile:@"/Users/development/Desktop/12t.png" forKey:@"file"]; 
[request setPostValue:[NSString stringWithFormat:@"This is a test."] forKey:@"message"]; 
[request startAsynchronous]; 

如果我添加CoreGraphics中,zlib的,CFNetwork框架和SystemConfiguration框架(MobileCoreServices未在我的Xcode中找到)我得到这些错误:

Undefined symbols for architecture x86_64: 
    "_Gestalt", referenced from: 
     -[oglView(checkOSXVersion) checkForOSVersion:] in oglView+checkOSXVersion.o 
     +[ASIHTTPRequest defaultUserAgentString] in ASIHTTPRequest.o 
    "_UTTypeCopyPreferredTagWithClass", referenced from: 
     +[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o 
    "_UTTypeCreatePreferredIdentifierForTag", 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 x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

回答

0

看起来好像你还没有包括ASI依赖的图书馆。检出setup instructions,具体步骤2:

Link with CFNetwork, SystemConfiguration, MobileCoreServices, CoreGraphics and zlib 
+0

问题更新 – hockeyman

+1

您需要添加libz.dylib和MobileCoreServices。他们绝对都应该在那里。如果不是libz,请尝试libz.1.2.5。 –

0

您是否包含了所有的依赖关系?因为你没有提到任何。 http://allseeing-i.com/ASIHTTPRequest/Setup-instructions 您应该包括CFNetwork,SystemConfiguration,MobileCoreServices,CoreGraphics和zlib。

的zlib和MobileCoreServices

通过可以包括libz.x.dylib如果你不能找到zlib的方式(我没有zlib的自己)。你应该拥有MobileCoreServices.framework,因为它们应该在CoreService框架中。如果没有它,那么你别无选择,要为了让ASI工作

+0

问题已更新 – hockeyman

0

试试这个安装一遍: - 选择项目 - 目标 - 选择构建阶段 - 检查ASIHTTPRequest .m文件被添加到“Link Binary with Libraries”

6

看来你在Mac OS X项目中使用ASIHttprequest。所以你需要遵循这个指示。

在Mac OS X中的项目

要在Mac的项目中使用ASIHTTPRequest使用ASIHTTPRequest,你需要进行链接:

  • SystemConfiguration.framework + zlib的(如上)
  • CoreServices.framework CFNetwork是Mac OS X上的CoreServices框架的一部分。除非您正在编写基于控制台的应用程序,否则您的应用程序可能已经设置以便与 CoreServices链接,但如果不是,只需按照上述方法以 的方式添加CoreServices.framework即可。

来源:http://allseeing-i.com/ASIHTTPRequest/Setup-instructions

4

你需要添加一些库,是必需的,ASSIHTTP使用这些framworks alright.those框架是: -libz.dylib -systemConfiguration -MobileCoreServices -CFNetwork