我在这段代码中一直收到错误:
// Interstitial iAd
-(void)showFullScreenAd {
// Check if already requesting ad
if (requestingAd == NO) {
interstitial = [[ADInterstitialAd alloc] init];
interstitial.delegate = self;
self.interstitialPresentationPolicy = ADInterstitialPresentationPolicyManual;
[self requestInterstitialAdPresentation];
NSLog(@"interstitialAdREQUEST");
requestingAd = YES;
}
}
-(void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAd didFailWithERROR");
NSLog(@"%@", error);
}
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd {
NSLog(@"interstitialAdDidLOAD");
if (interstitialAd != nil && interstitial != nil && requestingAd == YES) {
//[interstitial presentFromViewController:self];
//[interstitial presentInView:self.view] // I get an error on this line
NSLog(@"interstitialAdDidPRESENT");
if (interstitial.loaded) {
[self requestInterstitialAdPresentation]; //I also get an error on this line too
}
}
}
-(void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAdDidUNLOAD");
}
-(void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd {
interstitial = nil;
requestingAd = NO;
NSLog(@"interstitialAdDidFINISH");
}
与此特定行有关:
[self requestInterstitialAdPresentation];
这是我遇到的错误,我不知道此行需要更改为什么,以便错误停止:
-[UIView setShowsFPS:]: unrecognized selector sent to instance 0x146e241a0
我在使用相同类型的代码时曾经遇到此错误,通常会在我开始尝试实施插页式广告时出现。我似乎在尝试实施插页式广告方面遇到了很多麻烦,而且我已经阅读了很多教程。我不知道我做错了什么:(有人可以帮忙吗?
此致
赖安
答案 0 :(得分:1)
setShowsFPS:
是SKView
上的方法,但不是UIView
上的方法。
虽然我没有在您发布的代码中看到原因,但错误意味着正在将UIView
实例传递给期望SKView
的方法。设置异常断点以试图找出位置。可能不是你的代码触发了这个电话。