In a NativeScript app when using
Kinvey.User.login(), the following error is thrown:
"One or more parameters passed to a function were not valid"
The above error is only thrown when deploying the project on iOS simulators with iOS 11.
The error occurs because the Kinvey SDK is using a secure storage on iOS to save the active user details. This native iOS piece of functionality is not handled well in (all) iOS simulators. For example, the issue is always occurring with the latest Xcode (9.x.x) and iOS device simulator with iOS 11. It is working as expected on a physical iOS device.
Even that for best results it is always recommended to use an actual physical device you may sometimes need to use the iOS simulator. To work around the issue in the iOS simulator you may consider one of the following approaches:
add the Keychain Sharing capability via an entitlements file in your app's App_Resources/iOS directory as shown in one of the recent versions of the NativeScript template -https://github.com/NativeScript/template-master-detail-kinvey/blob/master/App_Resources/iOS/app.entitlements. Note that usually you do not need to use this setting in your production app if you do not need the Keychain Sharing enabled between your apps, however, this enables the simulator to "simulate" the access to this secure storage. It can be removed when you are moving your application package to production and publishing (given that you might not need to enable that Keychain Sharing in your app(s)).
create a simulator device with iOS 9
open the Xcode project of the NativeScript app and enable the Keychain Sharing capability for the app then run the app in the simulator from Xcode