Question

In my iOS app, I would like to retrieve a reference to my app delegate using [[UIApplication sharedApplication] delegate], however this is returning an instance of class UABaseAppDelegateSurrogate instead of my custom UIApplicationDelegate class.

I understand that this surrogate is somehow used for receiving notifications, but do I need this? My app delegate implements all necessary methods for receiving notifications, and I would like to bypass this surrogate class so I can call methods on my custom app delegate. I don't know when this started happening, but I used to get my custom app delegate from [[UIApplication sharedApplication] delegate].

Was it helpful?

Solution 2

From the Urban Airship docs:

The Urban Airship library will automatically integrate with your app, so you do not need to implement any of the push-related UIApplicationDelegate protocol methods or pass notifications to the library. The library is able to do this by setting itself as the app delegate, intercepting messages and forwarding them to your original app delegate. If you would like to disable this behavior and implement the delegate callbacks in your own delegate, you can set automaticSetupEnabled to NO in either your AirshipConfig.plist file or on a UAConfig object passed to [UAirship takeOff:(UAConfig *)config];

OTHER TIPS

I think it's application delegate from your framework. Take a look at main.m file, how UIApplicationMain is called? 3d parameter is application class, 4th is application delegate class. However, if you change it to your custom delegate class, you may lose framework's functionality. So you need to take a deeper look into UABaseAppDelegateSurrogate - maybe you can subclass it? Or completely get rid of it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top