2010-02-14 32 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框架。