如题,返回的时候数组变空,赋值的时候还是有值的
请问大神是什么原因导致赋值之后的list变成nil,应该怎么去修改 ???在线等,谢谢
@interface ViewController ()<UITableViewDataSource>
@property(nonatomic,strong) NSArray *list;
@end
- (NSArray *)list{
if (_list == nil) {
NSMutableDictionary *dict = @{@"key":txtKey.text}.mutableCopy;
NSString *url = [NSString stringWithFormat:@"http://192.168.59.133:8080/api/v1/getList"];
[[NetworkHelper sharedNewtWorkHelper] GETRequestWithUrl:url paramaters:dict successBlock:^(id object, NSURLResponse *response) {
NSLog(@"网络请求成功:%@ %@",object,[NSThread currentThread]);
NSArray * dictArray = [object objectForKey:@"List"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dictArray) {
cc *cc = [cc listWithDict:dict];
[tempArray addObject:cc];
}
dispatch_async(dispatch_get_main_queue(), ^{
_list = tempArray;
});
} FailBlock:^(NSError *error) {
NSLog(@"网络请求失败");
}];
}
return _list;
}