use Autolayout 一个让我纠结的问题,用try-catch解决
问题描述:
[myTabBarController presentMoviePlayerViewControllerAnimated:_moviePlayerController];
_myPlayer=[[MyNewPlayerController alloc] initWithNibName:@"MyNewPlayerController" bundle:nil];
[myTabBarController presentViewController:_myPlayer animated:YES completion:^{}];
@try {
_myPlayer=[[MyNewPlayerController alloc] initWithNibName:@"MyNewPlayerController"bundle:nil];
[myTabBarController presentViewController:_myPlayer animated:YES completion:^{}];
}
@catch (NSException *exception) {
NSLog(@"name----%@",exception.name);
NSLog(@"reason----%@",exception.reason);
}
@finally {
}
得到了,相应的输出:
name----NSInvalidUnarchiveOperationException
reason----Could not instantiate class named NSLayoutConstraint
浙公网安备 33010602011771号