Could not cast value of type 'LLAppDelegateProxy'

1.6k Views Asked by At

I have integrated the Localtyics iOS SDK. After this I am getting the error like below: Could not cast value of type 'LLAppDelegateProxy'

It means I am unable to get a reference of the App delegate object. I am in trouble now because I want Localytics & want a reference object of App delegate as well.

Does any body know a solution of this?

1

There are 1 best solutions below

2
On

Localytics replaces your AppDelegate behind-the-scenes with their proxy class (LLAppDelegateProxy). Localytics suggests creating a static reference to your original AppDelegate for access like so:

class AppDelegate: UIResponder, UIApplicationDelegate {
    static var originalAppDelegate: AppDelegate!

    // ...

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        AppDelegate.originalAppDelegate = self

        // ...

}

Access using:

AppDelegate.originalAppDelegate.someMethod()