afjsonrequestoperation

AFNetworking version 2 content-type error

有些话、适合烂在心里 提交于 2019-12-21 17:49:05
问题 I'm attempting to make an iphone app that will interact with a particular JIRA server. I've got the following code to log in: NSURL *url = [[NSURL alloc] initWithString:@"https://mycompany.atlassian.net/rest/auth/latest/session/"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSString *postString = [NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}", username, password]; [request setHTTPBody:[postString

Replacement for AFJSONRequestOperation in AFNetworking 2.x

南笙酒味 提交于 2019-12-17 23:27:35
问题 I am making a basic iPhone app with HTML Requests, by following this tutorial. The tutorial has me using AFJSONRequestOperation in AFNetworking. The trouble is, I'm using AFNetworking version 2, which no longer has AFJSONRequestOperation. So, of course, this code (from about half-way down the tutorial, under the heading " Querying the iTunes Store Search API ") doesn't compile: NSURL *url = [[NSURL alloc] initWithString: @"http://itunes.apple.com/search?term=harry&country=us&entity=movie"];

How to return a response object using AFJSONRequestOperation

十年热恋 提交于 2019-12-12 03:43:44
问题 I'm trying to get weather data by using AFJSONRequestOperation . The problem is I can't return the object when the query is done. Is there anyone know how to do that? My current implemation is - (NSDictionary *)getCityWeatherData:(NSString*)city { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://free.worldweatheronline.com/feed/weather.ashx?key=xxxxxxxxxxxxx&num_of_days=3&format=json&q=%@", city]]; NSURLRequest *request = [NSURLRequest requestWithURL:url];

AFNetworking version 2 content-type error

风格不统一 提交于 2019-12-04 09:55:08
I'm attempting to make an iphone app that will interact with a particular JIRA server. I've got the following code to log in: NSURL *url = [[NSURL alloc] initWithString:@"https://mycompany.atlassian.net/rest/auth/latest/session/"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSString *postString = [NSString stringWithFormat:@"{\"username\":\"%@\",\"password\":\"%@\"}", username, password]; [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]