无法解析托管在Google云端硬盘上的JSON [英] JSON hosted on Google Drive is not parsed

查看:107
本文介绍了无法解析托管在Google云端硬盘上的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析托管在我的Google云端硬盘上的json文件.我正在使用以下代码:

I'm trying to parse a json file hosted on my Google Drive. I'm using the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.


    NSURL* url = [NSURL URLWithString:@"https://docs.google.com/file/d/0B3CRs9y562F3a0VXTXNaekNiSXM/edit?usp=sharing"];

    NSURLRequest* request = [NSURLRequest requestWithURL:url];

    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
        if (!error) {
            NSDictionary* jsonDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
            NSLog(@"jsonDictionary \n%@", jsonDictionary);
        }
    }];


}

我检查了网址,发现它是代码,还是无法从Google云端硬盘访问.如果代码不好,我看不到它在哪里.如果无法从Google云端硬盘解析.json文件,我可以在哪里托管对此内容的访问权限?必须在我自己的域上吗?我曾考虑过托管在Google Code上,但是绝对看起来不像我所需要的版本控制以及所有其他功能.

I checked the url, and figure it's either the code, or no access from Google Drive. If the code is bad, I can't see where it is. If the .json file cannot be parsed from Google Drive, where can I host an have access to this content? Must it be on my own domain? I looked in to hosting on Google Code, but definitely does not look like what I need with version control, and all.

推荐答案

当我加载该URL时,我什么都没得到.另一个选择可能是将文档放在node.js api后面,然后从那里进行剩余调用,或者针对AWS S3对其进行备份,然后从那里进行调用.我不认为Google驱动器除了首先下载所有文本外,都不允许在原地进行解析.我认为使用api将其托管在诸如heroku之类的服务上将为您提供最佳服务.

When I load that url, i'm not really getting anything. another options might be to put the doc behind a node.js api and make rest calls from there, or back it against AWS S3 and make a call from there. I don't think google drive allows for parsing in place except for downloading all the text first. I think hosting it on a service such as heroku with an api will serve you best.

这篇关于无法解析托管在Google云端硬盘上的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆