Modifying AppController from unity script or plugin

Hi

I’m in the situation where I have to deal with the application:didReceiveLocalNotification message from the OS but our xcode project is not persistant. I cannot modify the unity xcode project only the scripts. I can however modify a plugin we use.

So I am wondering how I can add delegates to the AppController from either unity scripts or another iOS plugin?
Thank you,
-Sam

@micken, just use an Obj-C category on AppController.

Thanks for the response! I can’t seem to get that to work since the plugin doesn’t know what the AppController is… Sorry I’m very new to objective c. I am guessing there is some way to declare it so it will work at runtime (like you would in c++ by simply declaring it as a class with no body)

it worked!

@interface AppController
@end

in a header file of the plugin

and

@implementation AppController (delegates)
-(void) application:(UIApplication*)application didReceiveLocalNotification:(NSDictionary *)userInfo
{
// im doing stuff !
}
@end

in a .m file of the plugin

categories sure are handy. Thanks for the help :slight_smile:

Hey guys. I am having some trouble with the iphone Unity/OpenFeint plugin and it looks like categories have something to do with it. It seems the plugin creates a file called AppController+OpenFeint.mm which implements a category for AppController. But when i run my game, none of the functions in the category get called. Any ideas what I can do to fix this? I noticed that xcode doesn’t colour-code some of the keywords in the category, is that indicating something not being linked? For instance UIApplication isn’t colour-coded.

That’s the behaviour i was experiencing until i made sure the interface was defined.

Now this work with UnityAppController

1 Like