afnetworking

Error when uploading photo with AFNetworking

本小妞迷上赌 提交于 2019-12-10 11:57:42
问题 I am uploading a photo using AFNetworking and I am getting the infamous "request body stream exhausted" error. This is my code: ( _manager is a AFHTTPRequestOperationManager ) NSData *imageData = UIImageJPEGRepresentation(image, 1.0); AFHTTPRequestOperation *operation = [_manager POST:address parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { [formData appendPartWithFileData:imageData name:@"file" fileName:@"image.jpg" mimeType:@"image/jpeg"]; } success:^

Reachability lying about disconnected wifi network

蹲街弑〆低调 提交于 2019-12-10 11:15:42
问题 I use Stackmob SDK (which will end soon) and I assume they use AFNetworking for reachability. If a device is connected to a wifi network which is disconnected from the Internet, the reachability check will be positive and the following statement will be true: if ([self.appDelegate.client.networkMonitor currentNetworkStatus] == SMNetworkStatusReachable) { // reachable } How can I fine tune this check to overcome the present limitation? How can I check for real network reachability within this

Clarification about weak references and a retain cycles

自作多情 提交于 2019-12-10 09:30:44
问题 I have the following code: AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest: request]; operation.completionBlock = ^{ if([operation hasAcceptableStatusCode]){ } }; ARC doesn't seem to like [operation hasAcceptableStatusCode], and i get the following warning: "Capturing 'operation' strongly in this block is likely to lead to a retain cycle". I'm not very experienced with referencing, any idea whats the way to go here? Thanks, Shai 回答1: Blocks capture (retain)

AFNetworking 3.0 setImageWithURLRequest download progress

ⅰ亾dé卋堺 提交于 2019-12-10 02:50:15
问题 Does anyone have a nice working solution for getting the download progress when using the UIImageView+AFNetworking category and AFNetworking 3.0. This category, which I did use for versions up till 3.0 has stopped working now. Here is my own experimental version which sadly, for the moment, crashes randomly. 回答1: Here is the modified version of AFNetworking 3.0 in which you can show a progress while loading image from server using UIImageView+AFNetworking category. https://github.com

Unable to upload large videos to Facebook from iOS app

谁说胖子不能爱 提交于 2019-12-10 00:25:24
问题 I am trying to upload large files video files to Facebook, but regardless of the approach taken, the result is always the same. The process uploads between 5-35mb worth of data then times out. This happens on WiFi. I have tried with the Facebook SDK 3.1.1, iOS Social Library (i.e. SLRequest) and AFNetworking. The social library and afnetworking give time out errors, whereas the Facebook SDK just returns a Code 5, Operation Could Not Be Completed, HTML Error 200 but if I watch the network

IOS使用AFNetworking解析服务端(Java)返回的double类型时会自动添加很多0000000

孤街浪徒 提交于 2019-12-09 20:36:34
服务端语言:Java 字段类型为Double AFNetworking解析服务端返回的数据出现如下图问题: 上图中第一个红框标注的部分是我在服务端直接将Double转为String返回解析的结果,是正常的;第二个红框是直接用Double返回解析的结果,另外服务端使用SpringMVC @ResponseBody直接返回响应结果。 该怎么保证映射的结果准确呢? 来源: oschina 链接: https://my.oschina.net/u/1046089/blog/732691

Domain=NSURLErrorDomain Code=-1001 “The operation couldn’t be completed. (NSURLErrorDomain error -1001.)”

妖精的绣舞 提交于 2019-12-09 20:11:20
问题 my program is write for upload the picture from the cam,sample code below: #define WEBSERVICE_URL @"http://192.168.0.104/upload.php" - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissViewControllerAnimated:YES completion:^{ UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage]; NSData *imageData = UIImagePNGRepresentation(selectedImage); NSMutableURLRequest *request = [

clang: error: exit code 1 错误详解

自古美人都是妖i 提交于 2019-12-09 18:18:05
!最近一次在"导入Realm数据库,多人SVN协作时候发生错误",因为Relam核心库被墙,导致另一个电脑使用install时候报错;不使用pod手动导入即解决问题 先介绍什么样情况下会出现这个错误 重复添加某个库 某个库从pod管理到手动管理 pod库导入时同时导入framework 文件重复 一些库pod管理时,不同电脑报错 . . . 可以从如下几个方面着手排查 1.多人开发更新代码not found错误 查看错误中提到的类,并且在右侧勾选target ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) 2.更新完pod编译报错 检查Podfile,确认是否需要"use_frameworks!",如果不需要,去掉重新install platform :ios, '8.0' use_frameworks! target 'MyApp' do pod 'AFNetworking', '~> 2.6' pod 'ORStackView', '~> 3.0' pod 'SwiftyJSON', '~> 2.3' end 3.如果是新添加的第三方库,且不是静态库 找到 Build

Valid JSON, but 'Cocoa error 3840' from AFNetworking/NSJSONSerialization

删除回忆录丶 提交于 2019-12-09 18:08:13
问题 I've been hacking away for hours trying to solve this problem to no avail - it seems like my only option is to post here to see if anyone can shed some light on this issue. It may be an issue with AFNetworking, or (more likely), it may be an issue with my code. The code I am using works perfectly for 99% of the operations within my application. I am developing an app that leverages Elastic Search by building JSON searches, sending them off and receiving a response from the server. Here is an

Manage Dependencies of Multiple Targets with Cocoapods

戏子无情 提交于 2019-12-09 17:31:53
问题 I just started tinkering with cocoapods to manage dependencies of my iOS Projects. Currently I am trying to integrate unit tests using GHIOSUnit. I followed all their instructions and tried their sample tests and it all worked like charm. However, problems start when I start using my actual project files for testing. I am using AFNetworking for client server comms and whenever I access my sharedClient called 'CRLClient', a wrapper for AFHTTPClient, it gives me undefined symbols errors.