iOS UIApplicationDelegate


#1

I am trying out the sample code in https://docs.nativescript.org/core-concepts/application-lifecycle but am getting the following error on compilation;

error TS2314: Generic type ‘NSDictionary<KeyType, ObjectType>’ requires 2 type argument(s).

Anyone else tried this and have any tips on how to fix this?

Thanks


#2

of course I can just change NSDictionary to ‘any’ to get it to compile. But is this cheating? :slight_smile:


#3

Cheating… Ehhhh lol maybe a little.

Try the platform typings https://www.npmjs.com/package/tns-platform-declarations


#4

I get the error with those typings, they were already in my project. Should
have said


#5

Ahhh gotcha. Guess that’s not declared in the package :/. I don’t do much
iOS sorry.


#6

I believe the correct syntax for following Line in https://docs.nativescript.org/core-concepts/application-lifecycle:

applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary): boolean

should instead be:

applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<string: any>): boolean

The keys for lauchOptions are available here:
https://developer.apple.com/documentation/uikit/uiapplicationdelegate/launch_options_keys?language=objc