ios - AFNetworking 2.0 update on an existing project -
I recently updated my project to AFNetworking 2.0 and it seems that the AFHTTPClient file is missing.
I read the following:
It seems that I must now use AFHTTPRequestOperation?
If so, how can I modify the following code? New AFHTTPRequestOperation?
NSURL * url = [NSURL URLWithString: WEB_SERVICE_BASE_URL]; AFHTTP Client * Client = [[FHTP Client Elok] Init Withbase: URL]; [Client Register HTTP Operation Class: [AFJSONQuest Operation Class]]; [Client set default header: @ "Accept" value: @ "Application / Jason"]; [Customer postPath: LOGIN_PATH parameter: [NSDictionary dictionaryWithObjectsAndKeys: self.userNameOrEmail.text, @ "userNameOrEmail", self.password.text, @ "password", zero] Success: ^ (AFHTTPRequestOperation * operation, ID responseObject) {bool success = [[Response object valuecapcap: @ "success"] Bull Valley]; NSString * displayMessage = [responseObject valueForKeyPath: @ "displaymessage"]; If (success) {NSUserDefaults * defaults = [NSUserDefaults StandardUserDefaults]; [Default set object: self.userNameOrEmail.text forKey: @ "userNameOrEmail"]; [Default set object: for self.password.text: @ "password"]; // [Flary Set UserID: self.userNameOrEmail.text]; [SV displayHouseShowsootSwatstas: display message]; [Self shotgun viewer unpowered: yes complete: zero]; } And {{SVProgressHoody Show Errwitstats: Display Message]; }} Failure: ^ (FHTPPRQuest Operation * Operation, NSERR * Error) {NSLog (@ "Error:% @", error); [SVProgressHoody ShowAiraththathus: MSG_ERER_ERROR]; }]; Update: I did the following: FHttrivAccount Operation Manager * Manager = [FHTMLTPAVE Operation Manager Manager]; NSDictionary * parameter = [NSDDD Dictionary with Object Ends: Self.Username.text, @ "User", self.mail.text, @ "email", self. password. Text, @ "password", zero]; [Manager Post: WEB_SERVICE_BASE_URL parameters: Parameters success: ^ (AFHTTPRequestOperation * operation, ID responseObject) {bool success = [[responseObject valueForKeyPath: @ "success"] boolValue]? @ "No No"; NSString * displayMessage = [responseObject valueForKeyPath: @ "displaymessage"]; If (success) {[SV demonstrationHouseShoesootSatts: Displays Message]; [Self. Navigation Controller PopToRootViewControllerAnimated: Yes]; } And {{SVProgressHoody Show Errwitstats: Display Message]; }} Failure: ^ (FHTPPKAEASTA Operation * Operation, NSERR * Error) {[SVPGSHDD ShowRerththatus: MSG_ERER_ERROR]; }]; AFHTTPRequestOperationManager * Manager = [AFHTTPRequestOperationManager Manager]; NSDictionary * parameter = [NSDDD Dictionary with Object Ends: Self.Username.text, @ "User", self.mail.text, @ "email", self. password. Text, @ "password", zero]; [Manager Post: WEB_SERVICE_BASE_URL parameters: Parameters success: ^ (AFHTTPRequestOperation * operation, ID responseObject) {bool success = [[responseObject valueForKeyPath: @ "success"] boolValue]? @ "No No"; NSString * displayMessage = [responseObject valueForKeyPath: @ "displaymessage"]; If (success) {[SV demonstrationHouseShoesootSatts: Displays Message]; [Self. Navigation Controller PopToRootViewControllerAnimated: Yes]; } And {{SVProgressHoody Show Errwitstats: Display Message]; }} Failure: ^ (Afactiteepiarakeistapreshn * operation, Ansiarar * error) {[Sviprgrsacudi Soarrththats: Msji_ SERVER_ERROR]; }];
Comments
Post a Comment