You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

cordova-ios-plugin-userdefaults

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-ios-plugin-userdefaults

This plugin is used to save and load data to the app groups. It is used to share data between App and Share Extension.

0.0.1
Source
npm
Version published
Weekly downloads
191
-32.75%
Maintainers
1
Weekly downloads
 
Created
Source

Cordova NSUserDefaults Plugin for App Groups

Description

If you like to share some variables between your main app and an share extension, you need to save your variables in a NSUserDefaults container. The NSUserData container can be shared between your both apps and hold all the data you want to transfer.

Please make sure you add the App Groups in the XCode Project for sharing the container between apps.

Install

cordova plugin add https://github.com/MattiaMalonni/cordova-ios-plugin-userdefaults

Sample Code

The Plugin is only for iOS.

Save in UserDefaults

var options = { key: "foo", value: "bar", suite: "group.com.example" };

window.AppGroupsUserDefaults.save(
  options,
  () => console.log("success"),
  () => console.log("error")
);

Load from UserDefaults

var options = { key: "foo", suite: "group.com.example" };
window.AppGroupsUserDefaults.load(
  options,
  (data) => console.log(data),
  (error) => cosnole.log(error)
);

Keywords

cordova

FAQs

Package last updated on 08 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts