iOS弹出框的小问题

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior ()

我遇见的问题即是UIAlertController事件没加到控制器上,改为[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertVC animated:YES completion:nil];又遇见

'-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.'

再接着把这个加到主线程中,dispatch_async(dispatch_get_main_queue(), ^{

[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertVC animated:YES completion:nil];

解决了我的问题


});

你可能感兴趣的:(iOS弹出框的小问题)