[SOLVED] How to extend QIOSApplicationDelegate with category on ios?
-
Hi!
I have qt application for iOS and trying to add functions to application delegate. Guys on "this link":http://www.cutehacks.com/blog/2014/06/06/using-qt-to-build-an-omi-app-for-ios-and-android suggest to use categories to extend QIOSApplicationDelegate with own functionality.
Like this:@#import "QIOSApplicationDelegate+OmiAppDelegate.h"
#import <FacebookSDK/FacebookSDK.h>@implementation QIOSApplicationDelegate (OmiAppDelegate)
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
}
@end@
But when I write own category I'm getting error that QIOSApplicationDelegate is unknown.
What header or plugin should I include to make it known? (I searched for "qiosapplicationdelegate.h" on hard drive but didn't find it).Thanks!
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
-
Hi,
QIOSApplicationDelegate is in qtbase/src/plugins/platforms/ios
-
Beware that's pretty dangerous, next iteration of Qt might have this header changed so you might end up with an "invalid" delegate
-
You're welcome !
Since you have your delegate working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)
-
Complete Code:
In the .pro:
ios { OBJECTIVE_SOURCES = ios/ios_app_delegate.mm }
In ios/ios_app_delegate.mm:
#import "UIKit/UIKit.h" @interface QIOSApplicationDelegate @end @interface QIOSApplicationDelegate (WoboqApplicationDelegate) @end @implementation QIOSApplicationDelegate (WoboqApplicationDelegate) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSLog(@"launch!"); return YES; } @end