启动画面和主页之间的间隙(Segue 不工作,黑屏)
Interstitial between SplashScreen and HomePage (Segue not working, blackscreen)
我知道这是一个常见问题,但在阅读了所有类似问题后我没有找到答案。
所以这是我的问题,我正在将广告集成到我的应用程序中,基本上我想要实现的是在 SplashScreen
期间显示 Interstitial
,就在访问 HomePage
.
现在这就是我所拥有的:
- 启动应用程序 -> 显示启动画面 -> 显示主页,然后立即显示插页式广告。
我想要什么:
- 启动应用程序 -> 显示启动画面 -> 显示插页式广告,当广告关闭时,显示主页。
我可以在 SplashScreen
期间显示 Interstitial
,但是我的 performSegueWithIdentifier
不工作,它显示黑屏或 Splas 上的应用程序块enter code here
hScreen.
为了说明我的意思,这里是我的 SplashScreen
ViewController
.
的一些代码
- (void)loadHomeView
{
if(_isDataLoaded && !_isInterstitialDisplay && [MFPreferencesUtils firstLaunch] != nil)
{
[self createSplashInterstitial];
//I also tried with performSelectorOnMainThread
}
}
间隙代表:
-(void)adsAdapterInterstitialDisappear:(Adapter *)adsAdapter{
_isInterstitialDisplay = NO;
[self displayHome];
}
以及用户关闭广告时调用的 displayHome 方法:
-(void) displayHome
{
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:@"SplashscreenDisappearToHome" sender:self];
});
}
我认为这是一个简单的行为,也许我不太了解 Segues 是如何工作的,但是如果我不调用 Interstitial
而是直接调用我的 HomePage
它是正在工作。
- (void)loadHomeView
{
if(_isDataLoaded && !_isInterstitialDisplay && [MFPreferencesUtils firstLaunch] != nil)
{
[self performSelectorOnMainThread:@selector(displayHome) withObject:nil
waitUntilDone:NO];
}
}
感谢您的阅读,如果您有什么建议,请告诉我。
问题已解决,我可以通过在 viewDidAppear 中调用我的方法来修复它。这是在我的视图由于插页式广告尚未加载时对 performSegue 的调用。
我知道这是一个常见问题,但在阅读了所有类似问题后我没有找到答案。
所以这是我的问题,我正在将广告集成到我的应用程序中,基本上我想要实现的是在 SplashScreen
期间显示 Interstitial
,就在访问 HomePage
.
现在这就是我所拥有的:
- 启动应用程序 -> 显示启动画面 -> 显示主页,然后立即显示插页式广告。
我想要什么:
- 启动应用程序 -> 显示启动画面 -> 显示插页式广告,当广告关闭时,显示主页。
我可以在 SplashScreen
期间显示 Interstitial
,但是我的 performSegueWithIdentifier
不工作,它显示黑屏或 Splas 上的应用程序块enter code here
hScreen.
为了说明我的意思,这里是我的 SplashScreen
ViewController
.
- (void)loadHomeView
{
if(_isDataLoaded && !_isInterstitialDisplay && [MFPreferencesUtils firstLaunch] != nil)
{
[self createSplashInterstitial];
//I also tried with performSelectorOnMainThread
}
}
间隙代表:
-(void)adsAdapterInterstitialDisappear:(Adapter *)adsAdapter{
_isInterstitialDisplay = NO;
[self displayHome];
}
以及用户关闭广告时调用的 displayHome 方法:
-(void) displayHome
{
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:@"SplashscreenDisappearToHome" sender:self];
});
}
我认为这是一个简单的行为,也许我不太了解 Segues 是如何工作的,但是如果我不调用 Interstitial
而是直接调用我的 HomePage
它是正在工作。
- (void)loadHomeView
{
if(_isDataLoaded && !_isInterstitialDisplay && [MFPreferencesUtils firstLaunch] != nil)
{
[self performSelectorOnMainThread:@selector(displayHome) withObject:nil
waitUntilDone:NO];
}
}
感谢您的阅读,如果您有什么建议,请告诉我。
问题已解决,我可以通过在 viewDidAppear 中调用我的方法来修复它。这是在我的视图由于插页式广告尚未加载时对 performSegue 的调用。