afnetworking

Post method using Afnetworking in Objective-C

喜欢而已 提交于 2019-12-25 09:23:28
问题 How to write the code to sending POST method for the below JSON format using Afnetworking. { Media { Photo : image.jpg, UserId : 2 }, Personal { Name : aaa, Age : 30 }, Education { College : xxx, Course : yyy }, } 回答1: Obviously that's not quite the actual format, but we can guess what you might have meant. Clearly, if those numeric values (the user id and age) are expected as strings, then quote then, but hopefully it illustrates what the Objective-C representation of that dictionary might

AFNetworking 3.0 Multipart form data for uploading image error

£可爱£侵袭症+ 提交于 2019-12-25 09:06:30
问题 I've been trying to upload an image to my AWS server using multipart form data afnetworking 3.0 but apparently, every image I tried to upload ended up in the failure block. The codes in written in objective-c. - (NSURLSessionUploadTask *)uploadImageTask:(NSMutableDictionary *)dictionary { NSString *s3BucketUrl = [dictionary objectForKey:@"s3BucketUrl"]; NSData *imageData = [dictionary objectForKey:@"imageData"]; NSString *contentType = [dictionary objectForKey:@"contentType"]; NSString

Error:Request failed: bad request (400) login via afnetworking in swift

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 08:02:20
问题 I am new to swift and trying to login via AFNetworking which is working fine with Postman. let manager = AFHTTPSessionManager(baseURL: NSURL(string: "****")) manager.requestSerializer = AFHTTPRequestSerializer() manager.requestSerializer = AFHTTPRequestSerializer() let params = ["user":username,"password":password] manager.POST("/api/LoginApi/appLogin", parameters: params, success: { requestOperation, response in let result = NSString(data: response as! NSData, encoding: NSUTF8StringEncoding)

Return data after AFNetworking is done

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 06:35:49
问题 I got a async problem with my code. I got all of my webrequests in 1 class. One of my requests needs to return an NSMutableArray that another class needs to use. My webRequest code is here: - (NSMutableArray*) getTournamentsInClub:(NSString *)clubGUID withDelegateViewController:(UIViewController *)viewController { AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSMutableArray *responseArray = [[[NSMutableArray alloc] init] autorelease]; NSString *URL = [

AFIncrementalStore Problems fetching multiple remote relationships

ⅰ亾dé卋堺 提交于 2019-12-25 04:31:30
问题 I have a problem with AFIS fetching remote relationships, i'm connecting to Apigee API, properly setting relationships at - (NSDictionary *)representationsForRelationshipsFromRepresentation:(NSDictionary *)representation ofEntity:(NSEntityDescription *)entity fromResponse:(NSHTTPURLResponse *)response; then, spent a lot of time debugging, found that relation name and URL build is correct, exactly as i want but the AFHTTPClient never makes the network call, found out the reason in method: -

AFIncrementalStore Problems fetching multiple remote relationships

早过忘川 提交于 2019-12-25 04:31:18
问题 I have a problem with AFIS fetching remote relationships, i'm connecting to Apigee API, properly setting relationships at - (NSDictionary *)representationsForRelationshipsFromRepresentation:(NSDictionary *)representation ofEntity:(NSEntityDescription *)entity fromResponse:(NSHTTPURLResponse *)response; then, spent a lot of time debugging, found that relation name and URL build is correct, exactly as i want but the AFHTTPClient never makes the network call, found out the reason in method: -

AFNetworking + Many imageviews = Crash -> Received memory warning

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:31:13
问题 I 've never had problems with my app using AFNetworking, because I had like 20 imageview to show , but now my app crash because I want to set imagewithURL to 150 Imageviews, if I commented that line all is ok, this is my code: for (int i=0; i< Array.count; i++) { UIImageView *imgProd=[[UIImageView alloc] initWithFrame:CGRectMake(margenX, margenY, 220, 330)]; imgProd.contentMode = UIViewContentModeScaleAspectFill; imgProd.clipsToBounds = YES; [imgProd setTag:i]; // dispatch_async(dispatch_get

AFNetworking + Many imageviews = Crash -> Received memory warning

若如初见. 提交于 2019-12-25 04:31:07
问题 I 've never had problems with my app using AFNetworking, because I had like 20 imageview to show , but now my app crash because I want to set imagewithURL to 150 Imageviews, if I commented that line all is ok, this is my code: for (int i=0; i< Array.count; i++) { UIImageView *imgProd=[[UIImageView alloc] initWithFrame:CGRectMake(margenX, margenY, 220, 330)]; imgProd.contentMode = UIViewContentModeScaleAspectFill; imgProd.clipsToBounds = YES; [imgProd setTag:i]; // dispatch_async(dispatch_get

How I properly setup an AFNetworking Get Request?

谁说胖子不能爱 提交于 2019-12-25 04:23:06
问题 I'm trying to retrieve a line of code from my server and implement it in my NSUserDefaults . Right now, this is what my appdelegate.m looks like: NSDictionary* defaults = @{@"server_addr": @"http://156.92.15.802"}; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; The http://156.92.15.802 url is the part that I need to GET from my server. If my server has a file named Example.txt on it and within that file is a single line that like http://156.92.15.802 , how can I use

Is it possible to use NSFileManager's `copyItemAtURL:toURL:error:` method when the app is in the background?

青春壹個敷衍的年華 提交于 2019-12-25 02:55:17
问题 I'm working on an iOS app, uploading videos from the Camera Roll, using NSURLSession with a background configuration. The user can queue up multiple videos for upload (the queue is executed serially). A single upload consists of: Getting an AVURLAsset reference to the PHAsset using PHImageManager's requestAVAssetForVideo method. Copying the resource to a temp directory (because you cannot upload straight from the AVURLAsset's URL). Uploading the resource using an NSURLSessionUploadTask I can