我只是在尝试使用AFNetworking版本2的第一步。
由于有了新版本,现有的在线教程,如Ray Wenderlich的afnetworking-crash-course不再起作用。
从AFNetworking 2迁移指南中,我获得了以下代码:
https://github.com/AFNetworking/AFNetwor…迁移-指南
NSURL *URL = [NSURL URLWithString:@"http://example.com/foo.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]
initWithRequest:request];
operation.responseSerializer = [AFJSONSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@", responseObject);
} failure:nil];
[operation start];现在我已经添加了导入。
#import "AFNetworking.h"添加到.pch文件中。
问题:我总是收到错误消息,AFJSONSerializer是未声明的。
我忘了什么步骤了?
诚挚的问候
弗兰克
发布于 2013-10-18 22:15:40
这应该是AFJSONResponseSerializer,而不是AFJSONSerializer。
https://stackoverflow.com/questions/19451402
复制相似问题