Referencing third-party libraries Afnetworking
#import "AFNetworking.h"
#import "Uikit+afnetworking.h"
- (void) downloaddata{NSString*urlstring =[NSString Stringwithformat:limit_url,_page,_categoryid]; Afhttprequestoperationmanager*manager =[Afhttprequestoperationmanager Manager]; Manager.responseserializer=[Afhttpresponseserializer Serializer]; [Manager get:urlstring Parameters:nil success:^ (Afhttprequestoperation *operation,IDresponseobject) { //JSON parsing dataNsdictionary *dict =[nsjsonserialization jsonobjectwithdata:responseobject options:nsjsonreadingmutablecontainers Error:nil]; Nsarray*apps = dict[@"Applications"]; for(Nsdictionary *appdictinchapps) {Appmodel*model =[[Appmodel alloc] init]; [Model Setvaluesforkeyswithdictionary:appdict]; Model.desc= appdict[@"Description"]; [_dataarray Addobject:model]; [Self.tableview Reloaddata];//If the refresh table needs to be within block blocks}} failure:^ (Afhttprequestoperation *operation, Nserror *error) { }];}
Load images from the Web using a URL (#import "Uikit+afnetworking.h") via afnetworking
[Cell.iconimageview setimagewithurl:[nsurl URLWithString:model.iconUrl];
Afnetworking on-line loading data and JSON parsing