Hi,

On my iOS apps I’m using categories to be to catch the 
didFinishLaunchingWithOptions method:

@interface QIOSApplicationDelegate
@end
//! Add a category to QIOSApplicationDelegate
@interface QIOSApplicationDelegate (MyApplicationDelegate)
@end

@implementation QIOSApplicationDelegate (MyApplicationDelegate)

…

-(void)myNewMethodDeclaredOnMyApplicationDelegate;

@end

I was also calling a method from C++ in order to initialise a second app 
delegate.

+(MyAppDelegate*)sharedMyAppDelegate
- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    static dispatch_once_t pred;
    static MyAppDelegate *shared = nil;
    dispatch_once(&pred, ^{
        shared = [[super alloc] init];
    });

    return shared;
}

This was interfering with a lib I wanted to use, rendering it unusable. My 
option was to get ride of the secondary app delegate and use categories only.

The problem is that now, I don’t know how to call the AppDelegate from the C++ 
methods in the Cocoa side. I used to do something like this:

MyAppDelegate *app = [MyAppDelegate sharedMyAppDelegate];


Question: how can I refer from C++ on the Cocoa side to the AppDelegate 
associated with the category MyApplicationDelegate so that I can call 
myNewMethodDeclaredOnMyApplicationDelegate?

Thanks,

Regards,

Nuno
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to