84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
如果在不损害图片质量的情况下,转NSData,图片很大的情况下,如果是在主线程,会造成内存增大并且卡UI,如果是在子线程里,不会卡UI,但是内存同样会非常大.怎么解决呢?(注:测试图片,转出来data.length大约20M)
Unable to solve, converting to NSData is similar to a decompression operation and cannot reduce memory usage.
If you need to send it to the server, it is recommended to use the method shown in the picture below.
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil]; } error:nil];
Unable to solve, converting to NSData is similar to a decompression operation and cannot reduce memory usage.
If you need to send it to the server, it is recommended to use the method shown in the picture below.