Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not cast value of type 'LLAppDelegateProxy'

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?

like image 402
user3347272 Avatar asked Jun 20 '16 06:06

user3347272


1 Answers

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()
like image 87
JAL Avatar answered Oct 06 '22 23:10

JAL