After "google", I fix this exception with link:
http://stackoverflow.com/a/24749239
dispatch_async(dispatch_get_main_queue(), ^{
[self.pageViewController setViewControllers:@[ [self.storyboard instantiateViewControllerWithIdentifier:_pageStoryBoardIDs[0]] ]
direction:UIPageViewControllerNavigationDirectionReverse
animated:YES completion:nil];
});
Because the solution in link is writen in Objective-C, then I use the sniptcode:
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
// do some task
dispatch_async(dispatch_get_main_queue()) {
// update some UI
}
}
In link: https://thatthinginswift.com/background-threads/
0 nhận xét:
Đăng nhận xét