数据未在tableView中加载,也未更新配置文件

时间:2017-12-22 11:49:42

标签: ios objective-c json api

我是目标新手C.执行此程序点击“点击此处立即出售您的黄金”按钮 它将为您提供仪表板午餐。在仪表板中选择事务历史记录。我在TransactionHistoryViewController.m文件中有fetchNewHothistory函数,负责从url获取数据并将其显示在viewcontroller文件中

-(void)fetchNewHothistory
{
    NSTimer *t = [NSTimer scheduledTimerWithTimeInterval:1.0
                                                  target: self
                                                selector:@selector(mytimerChecking:)
                                                userInfo: nil repeats:NO];

    NSMutableDictionary *paramDict=[NSMutableDictionary dictionary];
    [paramDict setObject:@"ios" forKey:@"request"];
    [paramDict setObject:[NSString stringWithFormat:@"%@",currentUser.user_id] forKey:@"user_id"];
    [paramDict setObject:[NSString stringWithFormat:@"%@",self.currentLimitNew] forKey:@"limit_start"];

    [GeneralWebservices webserviceMainSplashCall:paramDict webserviceName:Webservice_TransactionHistory OnCompletion:^(id returnDict, NSError *error) {

        if ([returnDict[@"success"] intValue] ==1)
        {
//                        UIAlertView* alert = [[UIAlertView alloc] init];
//                        [alert setTitle:@"RECORD FOUND"];
//                       // [alert setMessage:returnDict[@"message"]];
//                        [alert addButtonWithTitle:@"OK"];
//                        [alert show];

            [history addObjectsFromArray:returnDict[@"data"]];
            self.currentLimitNew=[NSString stringWithFormat:@"%@",returnDict[@"limit_start"]] ;
            [historyTableView reloadData];
        }
        else
        {
            UIAlertView* alert = [[UIAlertView alloc] init];
            [alert setTitle:@"RECORD FOUND"];
            //[alert setMessage:returnDict[@"message"]];
            [alert addButtonWithTitle:@"OK"];
            [alert show];
        }
        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
        [historyTableView.pullToRefreshView stopAnimating];
        [historyTableView.infiniteScrollingView stopAnimating];

    }];

}

问题-1 记录已找到但在Viewcontroller上没有显示选择事务历史记录。如何在viewcontroller上显示记录?

问题-2 在选择Profile时,执行ProfileViewController.m。更新用户配置文件。它不会更新。它仍然保持缓冲。如何执行配置文件更新。 您可以从此链接下载项目。https://drive.google.com/file/d/1daW4veZAI21b8TqKFHauSFTboHKJceaG/view?usp=sharing

1 个答案:

答案 0 :(得分:0)

试试这个:

static async Task MainAsync()
{
    String accessToken = null;
    try
    {
        accessToken = await GetAccessTokenAsync("e", "p");
    }
    catch (Exception ex)
    {
        Console.Error.WriteLine("Failed to get access token.  " + ex.Message);
        return;
    }

    String resource = null;
    try
    {
        resource = await GetResourceAsync(accessToken);
    }
    catch (Exception ex)
    {
        Console.Error.WriteLine("Failed to get API resource.  " + ex.Message);
        return;
    }

    // do stuff
}