i trying convert dictionary array in objective-c. getting warning on line three. 'incompatible pointer types assigning nsdictionary parameter of type nsarray'. there way convert dictionary array without getting warning?
// in datasource.h @property (nonatomic,strong) nsarray *bars; // in masterviewcontroller.m afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; operation.responseserializer = [afjsonresponseserializer serializer]; operation.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"text/plain"]; [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) { nsdictionary *jsondict = (nsdictionary *) responseobject; _datasource.recievedjson = jsondict; _datasource.bars = [nsarray arraywitharray:jsondict]; self.title = @"bars"; [self.tableview reloaddata]; } failure:^(afhttprequestoperation *operation, nserror *error) { // display alert if error downlading data uialertview *alertview = [[uialertview alloc] initwithtitle:@"error retrieving weather" message:[error localizeddescription] delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alertview show]; }]; [operation start];
you saying:
[nsarray arraywitharray:jsondict]
but jsondict
nsdictionary, while arraywitharray:
expects nsarray. why doing that?
you need think how want turn dictionary array — if that's goal — , you need that. need understand structure of dictionary , think sort of "array" possibly turned into.