【发布时间】:2021-06-14 08:23:13
【问题描述】:
我是做目标 C 的初学者。
我试图理解/复制Jitsi code。
在他们的 AppDelegate.m 中,他们做了类似的事情
ViewController *rootController = (ViewController *)self.window.rootViewController;
[jitsiMeet showSplashScreen:rootController.view];
return YES;
线路:https://github.com/jitsi/jitsi-meet/blob/master/ios/app/src/AppDelegate.m#L59
这里显示SplashScreen是这个
- (void)showSplashScreen:(UIView*)rootView {
[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
}
RNSplashScreen showSplash 方法在哪里
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
if (!loadingView) {
loadingView = [[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
CGRect frame = rootView.frame;
frame.origin = CGPointMake(0, 0);
loadingView.frame = frame;
}
waiting = false;
[rootView addSubview:loadingView];
}
线路:https://github.com/crazycodeboy/react-native-splash-screen/blob/master/ios/RNSplashScreen.m
现在,我做了同样的事情,但他们使用的是 .xib 文件,而我使用的是故事板。
就像在我的 info.plist 我有这个
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
所以盲目地复制代码,我在我的项目中使用情节提要做了类似的事情,但我得到以下错误
someMobileMobile[73326:1790521] *** 由于未捕获而终止应用程序 异常'NSInternalInconsistencyException',原因:'无法加载 捆绑中的 NIB:'NSBundle /xyz/Library/Developer/CoreSimulator/Devices/1B60169F-B19B-459F-85C6-E80537C7B18B/data/Containers/Bundle/Application/5CDFA673-1009-49C3-8F7D-7F1A0C8E7F57/someMobileMobile.app> (已加载)',名称为 'LaunchScreen''
主要问题
这个错误是因为我使用的是故事板而不是 xib 吗?
次要问题
谁能解释一下上面粘贴的代码sn-p?最后,(ViewController *) 是什么意思
【问题讨论】:
标签: ios objective-c