Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xcode如何等待json数据解析?_Xcode_Json_Uitableview - Fatal编程技术网

xcode如何等待json数据解析?

xcode如何等待json数据解析?,xcode,json,uitableview,Xcode,Json,Uitableview,我正在使用json url从应用商店获取应用信息 在uitableview中显示信息之前,我必须解析此文件 我该怎么做 我的意思是等待所有json被解析并存储在nsarray中 任何帮助都将不胜感激。让我们假设您在viewDidLoad中开始所有好的工作。您所需要做的就是调用获取、解析和存储数据的方法,然后重新加载表视图。像这样: -(void)viewDidLoad { //this is your method where you parse data and put in your

我正在使用json url从应用商店获取应用信息

在uitableview中显示信息之前,我必须解析此文件

我该怎么做

我的意思是等待所有json被解析并存储在nsarray中


任何帮助都将不胜感激。

让我们假设您在
viewDidLoad
中开始所有好的工作。您所需要做的就是调用获取、解析和存储数据的方法,然后重新加载表视图。像这样:

-(void)viewDidLoad {
    //this is your method where you parse data and put in your array
    [self parseData];

    //this reloads the table view, assuming you have your data source set up
    [tableView reloadData];
}

很抱歉,事实上,CelllForRowatineXpath方法有问题,因为包含我要在tableView中显示的数据的数组尚未获取。那么,如何让tableView“等待”直到解析完成?这段代码做了一个长循环(nslog),然后崩溃了。哎哟,没看到这个!在
cellforrowatinexpath
方法中,在配置数组之前,应确保数组不是零。为了进一步帮助您,我需要更多的代码,否则我就不知道到底出了什么问题。