An open API service indexing awesome lists of open source software.

https://github.com/rdn87/cordova-plugin-gcnsusersdefaults

NSUsersDefaults Plugin (Cordova) for iOS
https://github.com/rdn87/cordova-plugin-gcnsusersdefaults

cordova-ios-plugin cordova-plugin ios javascript nsuserdefaults objective-c wrapper

Last synced: 4 months ago
JSON representation

NSUsersDefaults Plugin (Cordova) for iOS

Awesome Lists containing this project

README

          

# cordova-plugin-gcnsusersdefaults
NSUsersDefaults Wrapper Plugin for iOS

Author: [Giulio Caruso aka rdn](https://twitter.com/iosdeveloper87)

## Adding the Plugin ##

Use the Cordova CLI and type in the following command:

`cordova plugin add https://github.com/rdn87/cordova-plugin-gcnsusersdefaults`

## Description

With this plug-in you can share some variables/settings between your native code and javascript code, you can save your variables in NSUserDefaults STANDARD.

## Sample Code

The Plugin is only iOS Platform.

### Save (String) in NSUserDefaults

var data = {
key: "myKey",
value: "myValue"
};

GCNSUsersDefaults.saveStringByKey(function() {
// success function
}, function() {
// failed function
}, data);

### GET (String) from NSUserDefaults

var data = {
key: "myKey"
};

GCNSUsersDefaults.getStringByKey(function() {
// success function
}, function() {
// failed function
}, data);