I am trying to add Vungle video ads in my sprite kit skscene. I have a sprite node which is when clicked, should load the ad. The guide provided by Vungle https://github.com/Vungle/vungle-resources/blob/master/iOS-resources/iOS-dev-guide.md shows how to place an ad through a view controller.
VungleSDK* sdk = [VungleSDK sharedSDK];
[sdk playAd:self];
I have different SKScene and i want to play ad in the scene rather than i the view controller. How can i achieve it.
Following is my SKScene code where the user is clicking an SKSpriteNode and i want the ad to load.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
SKNode *n = [self nodeAtPoint:[touch locationInNode:self]];
if ( [n.name isEqual: @"play"]) {
[self levelSelect];
}
else if( [n.name isEqual: @"coins"]){
VungleSDK* sdk = [VungleSDK sharedSDK];
[sdk playAd:self.view]; //TODO
}
}
This gives error as i am not passing a view controller to the method playAd. Can someone guide me?