我的应用程序的逻辑如下:连接到服务器->获取JSON->如果成功:从CoreData中删除之前的数据->存入CoreData->在tableView中显示如果失败:从CoreData中获取并显示在tableView中我不知道在什么地方比在viewDidLoad方法中运行这个逻辑更好。所以在提到的方法中我有以下代码:importUIKitclassTopRatedViewController:UIViewController{varimportedRates:NSArray=[]varsuccessfullyConnected:Bool=trueoverridefuncviewDidLo