views:

161

answers:

1

I am strictly following the answers from http://stackoverflow.com/questions/125306/how-can-i-upload-a-photo-to-a-server-with-the-iphone.

This part below is the part that get called when my button is pressed.

NSLog(@"buttonPressed: %@", [ConnectServerTryViewController getPathForFile: @"myPic.png"]);
[[EPUploader alloc] initWithURL:[NSURL URLWithString:@"http://10.27.8.251/senior/uploader.php"]
        filePath: [ConnectServerTryViewController getPathForFile: @"myPic.png"] 
        delegate:self
       doneSelector:@selector(onUploadDone:)
      errorSelector:@selector(onUploadError:)];

and here's my static getPathForFile method of ConnectServerTryViewController class:

+ (NSString*) getPathForFile: (NSString*) st{
    NSString * path = [[NSBundle mainBundle] bundlePath];
    NSString * finalPath = [path stringByAppendingPathComponent: st];
    return finalPath; 
}

I am very sure that my php is correct. I can upload an image from my mac to my server without any problem, but below shows the output from XCode's console:

2009-11-24 15:43:31.177 ConnectServerTry[1645:20b] buttonPressed: /Users/myName/Library/Application Support/iPhone Simulator/User/Applications/4127CEB7-EFCA-4D84-B7CF-F78ED871A499/ConnectServerTry.app/myPic.png
2009-11-24 15:43:31.179 ConnectServerTry[1645:20b] Begin upload method
2009-11-24 15:43:31.180 ConnectServerTry[1645:20b] Trying urlRequest
2009-11-24 15:43:31.181 ConnectServerTry[1645:20b] Trying connection
2009-11-24 15:43:31.188 ConnectServerTry[1645:20b] Now, wait for the URL connection to call us back.
2009-11-24 15:43:33.781 ConnectServerTry[1645:20b] -[EPUploader(Private) connection:didReceiveResponse:]: self:0x0x3d19760

[Session started at 2009-11-24 15:43:33 +0700.]
2009-11-24 15:43:33.781 ConnectServerTry[1645:20b] -[EPUploader(Private) connection:didReceiveData:]: self:0x0x3d19760
2009-11-24 15:43:33.783 ConnectServerTry[1645:20b] -[EPUploader(Private) connection:didReceiveData:]: data: C:\AppServ\www\senior
There was an error uploading the file, please try again!
2009-11-24 15:43:33.784 ConnectServerTry[1645:20b] -[EPUploader(Private) connectionDidFinishLoading:]: self:0x0x3d19760
2009-11-24 15:43:33.784 ConnectServerTry[1645:20b] *** -[ConnectServerTryViewController onUploadError:]: unrecognized selector sent to instance 0x3d21c70
2009-11-24 15:43:33.785 ConnectServerTry[1645:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[ConnectServerTryViewController onUploadError:]: unrecognized selector sent to instance 0x3d21c70'
2009-11-24 15:43:33.785 ConnectServerTry[1645:20b] Stack: (
    8307803,
    2435731003,
    8689723,
    8259190,
    8111810,
    12403,
    12513,
    3020196,
    3020051,
    13428152,
    13426200,
    13426914,
    13426914,
    13429398,
    13088725,
    8091873,
    8088648,
    87949,
    88146,
    23633923,
    8304
)

Do you appear to know what are some of the possible errors here?

Thank you very much.

+1  A: 

onUploadError: is an invalid selector on ConnectServerTryViewController. How is onUploadError defined, and is it defined in the class ConnectServerTryViewController?

niklassaers