2
我試圖將我的應用程序遷移到iOS 7,因此我必須使用AFNetworking 2.0。AFNetworking 2.0和AFPropertylist
當我使用此代碼:
NSURL *plistURL = [NSURL URLWithString:@"/test.php"];
NSURLRequest *request = [NSURLRequest requestWithURL:plistURL];
AFHTTPRequestOperation *operation =
[[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = [AFPropertyListRequestSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id propertyList) {
//some code
}failure:nil];
[operation start];
}
我得到一個警告,而編譯錯誤: 警告:
Incompatible pointer types assigning to 'AFHTTPResponseSerializer<AFURLResponseSerialization> *' from 'AFPropertyListRequestSerializer *'
錯誤:
AFPropertyListRequestSerializer responseObjectForResponse:data:error:]: unrecognized selector sent to instance 0xdd83160
謝謝。錯誤和警告消失了。現在唯一的問題是,現在ActivityIndicator旋轉不停,沒有plist加載。它甚至沒有在代碼id propertyList){控制檯中的代碼後顯示NSLog。 – user2211417
不客氣。你所面臨的問題似乎超出了這個問題的範圍。你可以嘗試用'[[NSOperationQueue mainQueue] addOperation:operation];'而不是調用'start'開始操作,但我認爲你應該發佈另一個更具體的問題。 –