我只是嘗試我的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 –