问题
In IOS 7, we can enable iAd very easy when using:
self.canDisplayBannerAds = YES;
in code ViewDidLoad of UIViewController
However, I cannot use this in my ViewController (the ViewControl that load SKScene). My game is crash when loading.
So how can I active iAd in my game (using Sprite Kit)?
回答1:
You can only show iAd in a UIViewController subclass. You are doing it right. Put the following code in your UIViewController and not in the SKScene.
Please refer to this tutorial for the exact code: http://tutorials.veasoftware.com/2013/10/10/how-to-add-iads/
回答2:
It's possible that you are accessing the view property. When using iAds you need to replace .view with .originalContentView. For example:
SKView* skView = (SKView *)self.view;
is replaced with
SKView* skView = (SKView *)self.originalContentView;
来源:https://stackoverflow.com/questions/19740365/how-can-i-enable-iad-when-using-sprite-kit