0

我是 iphone 开发的新手。我想将图像从我的设备共享到由我自己处理的服务器。我在 android 和 iphone 设备上都这样做了。它从 Android 发布得很好,但每当我通过 iphone 发布时,我都会从服务器收到 500 条错误消息。我真的不知道我在哪里犯错了。每当我与服务器通信时,是否有任何协议阻止 iphone。

NSString *uploadUrl = [NSString stringWithFormat:@"--My url-- "];
NSURL *url = [NSURL URLWithString:uploadUrl];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSMutableString *m_strUploadedFileName = [NSMutableString stringWithFormat:@"pic_%@_%@.png",dateString,[prefs objectForKey:@"EmailId"]];

NSData *imageData = UIImageJPEGRepresentation(m_imageFish.image, 0.2);
NSLog(@"image data is %@",imageData);

[request setData:imageData withFileName:m_strUploadedFileName andContentType:@"image/jpg" forKey:@"--server parameter to send-- "];

    [request setDefaultResponseEncoding:NSISOLatin1StringEncoding];
[request setDelegate:self];
[request setRequestMethod:@"POST"];

[request startAsynchronous];
4

0 回答 0