Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get appDelegate with Urban AirShip (Swift)

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.

like image 730
krosh Avatar asked Jun 02 '15 14:06

krosh


1 Answers

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.

like image 113
Christer Nordvik Avatar answered Nov 15 '22 04:11

Christer Nordvik