8

After integrating Urban Airship, when I call

let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate

I always get nil. When I tried to get class of UIApplication.sharedApplication().delegate, it tells me, that it is UAAppDelegateProxy now.

But

let appDelegate = UIApplication.sharedApplication().delegate as? UAAppDelegateProxy

also returns nil.

How can I get my appDelegate?

Edit

I figured up, that this happens only when UAConfig parameter automaticSetupEnabled is set to true. When automaticSetupEnabled is false, I get appDelegate as usual, but I'm losing advantages of urban airship automatic configuration.

krosh
  • 218
  • 4
  • 15
  • 3
    For anyone Googling, I had a similar problem where using the Localytics autoIntegrate function was causing sharedApplication().delegate to return a LLAppDelegateProxy instead of the real thing. Removing Localytics fixed it. – rogueleaderr Jun 14 '15 at 07:55

1 Answers1

3

This is a bug in the Urban Airship SDK that they have promised to fix in the next SDK release.

From their support:

We are aware of this issue and are looking to have it resolved in our next SDK release. In the meantime, as a workaround, manually setting up our SDK will allow you to work with the AppDelegate successfully.

Christer Nordvik
  • 2,518
  • 3
  • 35
  • 52