我看了这个,但答案似乎总是特定于那个问题.
我正在尝试使用JSON从Web服务器请求信息,并将信息显示在表视图中.给我带来麻烦的代码如下:
CalendarCommunicator.m:
#import "CalendarCommunicator.h"
#import "CalendarCommDelegate.h"
@implementation CalendarCommunicator
- (void)searchGroupsAtCoordinate:(CLLocationCoordinate2D)coordinate
{
NSString *urlAsString = [NSString stringWithFormat:@"http://medpak.costarica.com/api/content/render/false/type/json/query/+structureName:calendarEvent%20+(conhost:9fe93d82-1cd8-46b1-9dda-8b940e407d23%20fonhost:SYSTEM_HOST)%20+languageId:1", coordinate.latitude, coordinate.longitude];
NSURL *url = [[NSURL alloc] initWithString:urlAsString];
NSLog(@"%@", urlAsString);
[NSURLConnection sendAsynchronousRequest:[[NSURLRequest alloc] initWithURL:url] queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (error) {
[self.delegate fetchingGroupsFailedwithError:error];
} else {
[self.delegate recievedGroupsJSON:data];
}
}];
}
@end
Run Code Online (Sandbox Code Playgroud)
在本NSString *urlAsString节中,我收到了一个URL警告.它说'"无效的转换说明符'+'".这到底是什么意思?URL中有很多"+"符号,或者我遗漏了什么?