私のアプリでは、Google マップを使用してユーザーの隣の場所を検索しています。JSON 応答ファイルのクエリと解析は、URL に 1 種類の場所 (食べ物など) しか含まれていない場合に正常に機能します。/ 別のタイプ (food|bar など) を追加すると、NSDictionary 行でアプリがクラッシュします。コードは次のとおりです。
NSString *urlString = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&radius=%@&types=food|restaurant&sensor=true&key=%@", currentLocation.coordinate.latitude, currentLocation.coordinate.longitude, [NSString stringWithFormat:@"%i", 1000], kGOOGLE_API_KEY];//|bar|cafe|casino|gym|amusement_park|night_club|park|restaurant|shopping_mall|stadium
NSURL *requestURL = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:(requestURL)];
//response
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSError *jsonParsingError = nil;
NSDictionary *locationResults = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError]; //ERROR IS HERE
NSLog(@"%@",locationResults);
エラーが発生している場所を指摘しました (Xcode のブレークポイントがそれを指しています)。私のコードに何か問題がありますか、それとも不足していますか?