Huygamer
Huygamer

Reputation: 162

How can I enable iAd when using Sprite Kit?

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)?

Upvotes: 3

Views: 2504

Answers (2)

BalestraPatrick
BalestraPatrick

Reputation: 10144

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/

Upvotes: 3

bytespider
bytespider

Reputation: 586

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;

Upvotes: 0

Related Questions