美文网首页
AFNetworking

AFNetworking

作者: 自知则知 | 来源:发表于2018-11-13 16:01 被阅读0次

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    [manager GET:URL parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {

    }success:^(NSURLSessionDataTask*_Nonnulltask,id  _NullableresponseObject) {

        NSLog(@"%@",responseObject);

[NewsModel mj_setupObjectClassInArray:^NSDictionary *{

            return@{

                @"list":@"ListModel",

                @"list":@"LIstModelTWO",

                @"data":@"dataModel"

            };

        }];

        self.model= [Model mj_objectWithKeyValues:responseObject];

        NSLog(@"asdf");

        [self.tableViewreloadData];

    }failure:^(NSURLSessionDataTask*_Nullabletask,NSError*_Nonnullerror) {

        NSLog(@"%@",error);

    }];

Model"::::  .h

先数组

@interfaceNewsModel :NSObject

@property (nonatomic , copy) NSArray *list; //数组一

@end

@interfaceListModel :NSObject

@property (nonatomic , copy) NSString *moduleType;

@property (nonatomic , copy) NSArray *list;  //数组二

@end

cell::

//    ListModel *listModel = self.newsModel.list[0];

//    NSDictionary *dic = listModel.list[0];

//    NSArray *arr = dic[@"data"];

//    NSDictionary *dataDic = arr[indexPath.row];

//

//    cell.imageView.image = [UIImage imageWithData:[self ImageWithString:dataDic[@"cover"]]];

//    ListModel *listModel = self.newsModel.list[0];

//  listModel.moduleType

-(NSData*)ImageWithString:(NSString*)string{

    NSURL*url = [NSURLURLWithString:string];

    return [NSData dataWithContentsOfURL:url];

}

相关文章

网友评论

      本文标题:AFNetworking

      本文链接:https://www.haomeiwen.com/subject/zejlfqtx.html