在创建统一插件时,我需要重写AppController函数。
所以我通过IMPL_APP_CONTROLLER_SUBCLASS宏注册了一个子类,但是我遇到了其他插件崩溃的问题
@interface Test1 : UnityAppController
@end
@interface Test2 : UnityAppController
@end
IMPL_APP_CONTROLLER_SUBCLASS (Test1)
IMPL_APP_CONTROLLER_SUBCLASS (Test2)
@implementation Test1
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
NSLog(@"-> Test1 :: applicationDidFinishLaunching()\n"); // <- NOT WORKING!
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
@implementation Test2
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
NSLog(@"-> Test2 :: applicationDidFinishLaunching()\n");
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
如果多次使用IMPL_APP_CONTROLLER_SUBCLASS,则将仅应用其中之一,因此将不会调用Test1中的FinishLaunchingWithOptions。
有没有一种方法可以在不覆盖AppController的情况下获得函数调用?