[英]Unable to pass NSString between ViewControllers, while other objects can
[英]Unable to move between ViewControllers
我的應用程序下載數據,下載數據后,我試圖將用戶送回應用程序的主ViewController,但無法正常工作。
碼:
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
Full_Sync *fullSyncController = [storyboard instantiateViewControllerWithIdentifier:@"ViewControllerROOTIdentifier"];
[self.navigationController pushViewController:fullSyncController animated:NO];
該方法在NSlog工作時被調用,但是此代碼似乎沒有運行。 該代碼可在應用程序的其他部分完美運行。 不知道為什么它從這里不起作用。
收到API的結果后,請確保返回主線程。 網絡調用是在另一個線程上執行的異步任務,並且由於您需要在主線程上執行任何與UI相關的操作,因此您需要執行以下操作(Objective-C):
dispatch_async(dispatch_get_main_queue(), ^{
// Perform your transition here.
});
您還需要確保執行過渡的視圖控制器嵌入到UINavigationController中!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.