سؤال

How to solve the crashing in ASIHttpRequest.m file. I'm sending Uiimage to server by bytes format,

NSMutableData *imageData = [UIImageJPEGRepresentation(image, 1.0f) mutableCopy];
    [request setPostBody:imageData];
    [request addRequestHeader:@"fileName" value:[[imageArray objectAtIndex:selectedIndex] filename]];
 [request setDelegate:self];
[request startAsynchronous];

But app crashing fail with error method.

هل كانت مفيدة؟

المحلول

Why are you setting header of the image type.Just set Post header and responsetype header.And after getting image data just make it encoded.

نصائح أخرى

you can try out of two method

[request setFile:@"File Path" withFileName:@"image.png" andContentType:@"image/png" forKey:@"file"];

[request setData:Data withFileName:@"image.png" andContentType:@"image/png" forKey:@"file"];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top