1

im want use this Class How can I upload a photo to a server with the iPhone? to Upload an image from my iPhone App to my Webserver.

Ive Copyd the header and main file and added "#import "EPUploader.m"" to my ViewControler where i call the EPUploader Method.

Error Message is:

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

Sorry if its a noobie question.. im new to this :)

Community
  • 1
  • 1
philipp
  • 319
  • 1
  • 4
  • 12

2 Answers2

6

You should add libz.dylib framework in your project.

shimdh
  • 79
  • 1
  • 4
1

The question you link to shows this comment for the compress: method (edited for brevity):

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

And inside the method, the call to compress():

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

It looks to me like you're not linking zlib with your application, so the linker can't figure out how to call compress(). The zlib homepage has everything you need to integrate the library with your app.

Also - it's a little weird to do #import "EPUploader.m". Normally you would only #import a header file.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469