2010-02-14 66 views
1

即时通讯要使用此类How can I upload a photo to a server with the iPhone?上传图像从我的iPhone应用程序到我的网络服务器。错误未定义的符号:“_compress”与图片上传类

Ive Copyd的标题和主文件,并添加“#import”EPUploader.m“”我的ViewControler,我称之为EPUploader方法。

错误消息:

Ld build/Release-iphonesimulator/PhotoApp.app/PhotoApp normal i386 
cd /Users/phil/PhotoApp 
setenv MACOSX_DEPLOYMENT_TARGET 10.5 
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -L/Users/phil/PhotoApp/build/Release-iphonesimulator -F/Users/phil/PhotoApp/build/Release-iphonesimulator -filelist /Users/phil/PhotoApp/build/NaoUp.build/Release-iphonesimulator/PhotoApp.build/Objects-normal/i386/PhotoApp.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/phil/PhotoApp/build/Release-iphonesimulator/PhotoApp.app/PhotoApp 

Undefined symbols: 
    "_compress", referenced from: 
     -[EPUploader(Private) compress:] in EPUploader.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 

很抱歉,如果它是一个noobie问题..即时通讯新的这个:)

回答

1

您链接到显示了问题的compress:方法此评论(编辑为简洁起见) :

* -[Uploader(Private) compress:] -- 
*  Uses zlib to compress the given data. 

而且方法中,调用compress()

int error = compress([destData mutableBytes], 
        &destSize, 
        [data bytes], 
        [data length]); 

它看起来像我没有链接zlib与您的应用程序,所以链接器无法弄清楚如何拨打compress()zlib homepage拥有将库与应用程序集成所需的一切。

另外 - 这是有点奇怪做#import "EPUploader.m"。通常你只有#import一个头文件。

6

您应该在您的项目中添加libz.dylib框架。