Getting crash "Could not cast value of type 'LLAppDelegateProxy' "

1.1k views Asked by At

I have a method in my AppDelegate file. Which I was calling from another class. But after implementing Localytics I am getting a crash. Here is how I was calling the method.

 let delegate = UIApplicatin.shared.delegate as ! AppDelegate
 delegate.myFunction()

I have tried this answer from Stack Overflow. Its does not crash the app but method is not called.

1

There are 1 answers

0
Asim Iftikhar Abbasi On BEST ANSWER

Got it working. Actually I was missing the line in didFinishLauncihingWithOptions as mentioned in This answer. We have to do this.

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