ios - Copy objects from NSArray to another NSArray -
i'm making ios app using vksdk. want copy data response.json[@"items"](it's nsarray,response.json nsdictionary) nsarray. here code:
vkrequest * getwall = [vkrequest requestwithmethod:@"wall.get" andparameters:@{vk_api_owner_id : @"1"} andhttpmethod:@"get"]; [getwall executewithresultblock:^(vkresponse * response) { _vk_array=[[nsarray alloc]initwitharray:response.json[@"items"]]; nslog(@"%@",_vk_array);//shows null nslog(@"%@",response.json[@"items"]);//shows ok } errorblock:^(nserror * error) { if (error.code != vk_api_error) { [error.vkerror.request repeat]; } else { nslog(@"vk error: %@", error); } }]; i trying use code
_vk_array=response.json[@"items"] but still shows "null". doing wrong?
ps:
nslog(@"%hhd",([response.json[@"items"] iskindofclass:[nsarray class]]));//shows 1
hi can use copy array object array.
nsarray *copyarray = [nsarray arraywitharray:yourarray]; thanks
Comments
Post a Comment