Accessing the viewController in MyCoronaDelegate

In the MyCoronaDelegate implementation I implemented the following, working on the Flurry Ads implementation:

- (void)spaceDidDismiss:(NSString \*)adSpace interstitial:(BOOL)interstitial{  
  
 if (interstitial) {  
 NSLog(@"Full Screen Ad Closed ");  
 }  
 else  
 {  
 NSLog(@"Banner Ad Closed ");  
 }  
  
 [FlurryAds fetchAndDisplayAdForSpace:@"Block Struggle iOS" view:appViewController.view size:BANNER\_BOTTOM];  
}  

But, obviously this function doesn’t know about the appViewController which is in the runtime. How do I retrieve the appViewController in MyCoronaDelegate? [import]uid: 66464 topic_id: 33867 reply_id: 333867[/import]

I got this working, but I don’t know if it’s a “good” solution.

I added following in the MyCoronaDelegate.h:

  
@interface MyCoronaDelegate : NSObject\< CoronaDelegate \>  
{  
 UIViewController \*\_selectedViewController;  
}  
@end  

And following to the MyCoronaDelegate.m:

[code]

  • (void)didLoadMain:(id)runtime
    {
    _selectedViewController = runtime.appViewController;
    }
    [/code] [import]uid: 66464 topic_id: 33867 reply_id: 134783[/import]

I got this working, but I don’t know if it’s a “good” solution.

I added following in the MyCoronaDelegate.h:

  
@interface MyCoronaDelegate : NSObject\< CoronaDelegate \>  
{  
 UIViewController \*\_selectedViewController;  
}  
@end  

And following to the MyCoronaDelegate.m:

[code]

  • (void)didLoadMain:(id)runtime
    {
    _selectedViewController = runtime.appViewController;
    }
    [/code] [import]uid: 66464 topic_id: 33867 reply_id: 134783[/import]