我只是尝试我的AFNetworking第二版的第一步。为新手AFNetworking 2迁移
由于新版本的现有在线教程,如 Ray Wenderlich 的网络碰撞过程不再起作用。
从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未声明。
我忘记了哪一步?
问候
弗兰克
如果是,请标记答案正确。欢迎来到堆栈溢出:D –