Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a plugin for iOS that allows you to get a UUID (Universal Unique Identif

Inspired from [`StackOverflow: How to preserve identifierForVendor in ios after uninstalling ios app on device?`] (http://stackoverflow.com/questions/21878560/how-to-preserve-identifierforvendor-in-ios-after-uninstalling-ios-app-on-device).

Uses [`SSKeychain Cocoa Pod`](https://cocoapods.org/pods/SSKeychain).
Uses [`SAMKeychain Cocoa Pod`](https://cocoapods.org/pods/SAMKeychain).

## Installation
`tns plugin add nativescript-ios-uuid`
Expand Down
5 changes: 5 additions & 0 deletions index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const platformModule = require("tns-core-modules/platform");

exports.getUUID = function () {
return platformModule.device.uuid;
};
4 changes: 2 additions & 2 deletions index.ios.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function getUUID() {
var appName = NSBundle.mainBundle.infoDictionary.objectForKey(kCFBundleNameKey);
var strApplicationUUID = SSKeychain.passwordForServiceAccount(appName, "incoding");
var strApplicationUUID = SAMKeychain.passwordForServiceAccount(appName, "incoding");
if (!strApplicationUUID){
strApplicationUUID = UIDevice.currentDevice.identifierForVendor.UUIDString;
SSKeychain.setPasswordForServiceAccount(strApplicationUUID, appName, "incoding");
SAMKeychain.setPasswordForServiceAccount(strApplicationUUID, appName, "incoding");
}

return strApplicationUUID;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "nativescript-ios-uuid",
"version": "0.0.1",
"description": "A NativeScript plugin for iOS that allows you to get a UUID (Universal Unique Identifier) for a device.",
"main": "index.js",
"main": "index",
"nativescript": {
"id": "org.nativescript.iosuuid",
"platforms": {
"ios": "1.3.0"
"android": "3.0.0",
"ios": "3.0.0"
}
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pod 'SSKeychain'
pod 'SAMKeychain'