标签:
NSString *page = [NSString stringWithFormat:@"%i",_page];
NSString *mystr2=[NSString stringWithFormat:@"http://123.57.1.143/api/user/3/feeds?p=%@",page];
//NSLog(@"%@",mystr2);
NSURL *url2 = [NSURL URLWithString:[mystr2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSURLRequest *request2 = [NSURLRequest requestWithURL:url2];
AFHTTPRequestOperation *operation2 = [[AFHTTPRequestOperation alloc] initWithRequest:request2];
[operation2 setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString *html = operation.responseString;
NSData* data=[html dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dict=[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
//NSLog(@"获取到的数据为:%@",dict);
_tempArray = [dict objectForKey:@"data"];
// NSLog(@"--------%@",_tempArray);
//
[refreshView performSelector:@selector(endRefreshing) withObject:nil afterDelay:1];
}failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// NSLog(@"发生错误!%@",error);
//提示用户加载失败
}];
NSOperationQueue *queue2 = [[NSOperationQueue alloc] init];
[queue2 addOperation:operation2];
标签:
原文地址:http://www.cnblogs.com/songpengpeng/p/4401511.html