-1
我使用HTTP获取方法从URL中获取值,在URL响应越来越,但对我来说价值不来,任何人都可以帮助我。下面是我的编码HTTP获取方法获取空值
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://www.gmasa.org/wp-json/posts?type=owl-carousel&filter[Carousel]=speakers&filter[posts_per_page]=-1"]];
NSURLResponse *requestResponse;
NSHTTPURLResponse *HTTPResponse = (NSHTTPURLResponse *)requestResponse;
NSInteger statusCode = [HTTPResponse statusCode];
NSData *requestHandler = [[NSData alloc]init];
requestHandler = [NSURLConnection sendSynchronousRequest:request returningResponse:&requestResponse error:nil];
NSLog(@"requestresponce: %@", requestHandler);
NSString *requestReply = [[NSString alloc] initWithBytes:[requestHandler bytes] length:[requestHandler length] encoding:NSASCIIStringEncoding];
NSLog(@"requestReply: %@", requestReply);
我请求句柄值也越来越喜欢这个“<>”,什么是问题。
你应该看看这个库:https://github.com/AFNetworking/AFNetworking...我认为它会帮助你解决很多问题! –