简体   繁体   English

AFNetworking:图像未在iOS 8之前上传

[英]AFNetworking : Image is not uploading pre iOS 8

I'm using AFNetworking in my app to make possible client-server communication. 我在我的应用程序中使用AFNetworking来实现客户端与服务器之间的通信。 Its working great. 它的工作很棒。 But today, our tester encounter an issue, that we can't upload an image to the server on device which having iOS 7.0. 但是今天,我们的测试人员遇到了一个问题,即我们无法将图像上传到装有iOS 7.0的设备上的服务器。 and 7.1. 和7.1。 (Note: we're targeting app from iOS 7.0. >= versions) We've encountered this on simulator as well. (注意:我们的目标是从iOS 7.0开始的应用程序。> =版本)我们也在模拟器上遇到过。

Have someone ever encounter this before? 有人遇到过吗? I'm not posting the code as its working with iOS 8 and later versions. 我没有将代码发布为与iOS 8和更高版本一起使用。 So I'm sure, there's no issue with the code. 因此,我敢肯定,代码没有问题。 However, I think, the issue may inside AFNetworking framework? 但是,我认为, AFNetworking框架内部可能存在问题?

PS. PS。

  • We're using latest version of AFNetworking framework. 我们正在使用最新版本的AFNetworking框架。
  • All other API calls working fine in both of the iOS versions. 所有其他API调用在两个iOS版本中均能正常工作。
  • I'm using AFHTTPSessionManager to call my API. 我正在使用AFHTTPSessionManager调用我的API。 (Available from iOS 7.0.) (适用于iOS 7.0。)

Please help! 请帮忙!

Let me know, if you want more info. 让我知道,如果您需要更多信息。 on this. 在此。

Please check with this code: 请检查以下代码:

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

    AFHTTPRequestOperation *op = [manager POST:urlString parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {

     [formData appendPartWithFileData:imageData name:@"image" fileName:@"photo.png" mimeType:@"image/png"];

    } success:^(AFHTTPRequestOperation *operation, id responseObject {

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

}];

[op start];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM