Giter Site home page Giter Site logo

rdn87 / cordova-plugin-gcnsusersdefaults Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 7 KB

NSUsersDefaults Plugin (Cordova) for iOS

License: MIT License

Objective-C 86.88% JavaScript 13.12%
nsuserdefaults ios cordova-plugin wrapper objective-c javascript cordova-ios-plugin

cordova-plugin-gcnsusersdefaults's Introduction

cordova-plugin-gcnsusersdefaults

NSUsersDefaults Wrapper Plugin for iOS

Author: Giulio Caruso aka rdn

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);

cordova-plugin-gcnsusersdefaults's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

freddyz

cordova-plugin-gcnsusersdefaults's Issues

Can't add plugin using cli

running

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

gives me this:

Error: Failed to fetch plugin https://github.com/rdn87/cordova-plugin-gcnsusersdefaults.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 235 Error output:
npm ERR! addLocal Could not install /var/folders/y8/knldndlj1838nflx72y1m0hr0000gn/T/npm-48953-a48a4a76/git-cache-0063a6fc/8db7eeccf650cfe33869037fe30b9cf8038b3623
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/Cellar/node@6/6.11.0/bin/node" "/usr/local/opt/node@6/bin/npm" "install" "https://github.com/rdn87/cordova-plugin-gcnsusersdefaults.git" "--production" "--save"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.