objective c - ios: Updating UITableView inside AFNetworking success callback -


i'm trying load data api , show inside uitableview. used afnetworking network calls, i'm facing problem: can't access mytableview nor self inside success block.

@property (weak, nonatomic) iboutlet uitableview *mytableview;  @property (nonatomic,retain) nsmutablearray *mydatasource;  @synthesize featuredproductstableview;  - (void)viewdidload {     [super viewdidload];     networkmanager *networkmanager = [networkmanager  getinstance];     mydatasource = [nsmutablearray array];       [networkmanager getpath:@"example.com" parameters:nil success:^(afhttprequestoperation *operation, id json) {         [mydatasource addobjectsfromarray:json];          [mytableview reloaddata];       } failure:^(afhttprequestoperation *operation, nserror *error) {         nslog(@"%@",error);     }]; } 

debugging code shows inside block can't access of self, mydatasource, or mytableview.

how can solve issue?

thanks.

you should use :

__block mydatasource = [nsmutablearray array]; 

you can read:

what "__block" keyword mean?


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -