[Interest] QIOSApplicationDelegate and Categories
Nuno Santos
nunosantos at imaginando.pt
Wed May 10 12:20:33 CEST 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170510/a900142f/attachment.html>
More information about the Interest
mailing list