0
試圖從Instagram解析簡單的JSON數據,但堅持這個問題。 JSON數據返回在應用程序中被截斷,但通過我的mac上的瀏覽器,一切正常。Instagram的API json數據被截斷通過應用程序,但在瀏覽器中確定
試圖做很多不同的方式,但都是一樣的。
第一種方式:
NSURL *instaGetRecentOwnerPhotosURL = [NSURL URLWithString:@"https://api.instagram.com/v1/users/self/media/recent/?access_token=MY_PROPER_TOKEN"];
NSData *jsonData = [NSData dataWithContentsOfURL:instaGetRecentOwnerPhotosURL];
的另一種方式,assync:
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://api.instagram.com/v1/users/self/media/recent/?access_token=MY_PROPER_TOKEN"]];
__block NSDictionary *json;
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
json = [NSJSONSerialization JSONObjectWithData:data
options:0
error:nil];
NSLog(@"Async JSON: %@", json);
}];
JSON數據恢復這樣的: screenshot of truncated json
絕對不知道什麼是錯的。
謝謝!真的,新的XCode 8在真實設備上運行時沒有顯示整個json結果,但是在模擬器上運行時顯示整個結果。我發現它很奇怪。想想,可以在偏好設置中關閉此功能。 –