Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6A70D1850E for ; Tue, 28 Jul 2015 18:21:45 +0000 (UTC) Received: (qmail 21529 invoked by uid 500); 28 Jul 2015 18:21:39 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 21500 invoked by uid 500); 28 Jul 2015 18:21:39 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 21272 invoked by uid 99); 28 Jul 2015 18:21:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jul 2015 18:21:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D244DE35E6; Tue, 28 Jul 2015 18:21:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Date: Tue, 28 Jul 2015 18:21:42 -0000 Message-Id: <05d19d5331274916aa396b89e2bf6fbe@git.apache.org> In-Reply-To: <10d9d8cb32804d1797814351cb737ae4@git.apache.org> References: <10d9d8cb32804d1797814351cb737ae4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/7] cordova-plugin-device git commit: Check user defaults first to maintain backwards compatibility Check user defaults first to maintain backwards compatibility Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/1f1c0e65 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/1f1c0e65 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/1f1c0e65 Branch: refs/heads/master Commit: 1f1c0e655e965f0143cca288faeb64f0a5d34f8f Parents: 3c125c8 Author: Jordan Clist Authored: Sat Jul 18 20:00:30 2015 +1200 Committer: Jordan Clist Committed: Sat Jul 18 20:00:30 2015 +1200 ---------------------------------------------------------------------- src/ios/CDVDevice.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/1f1c0e65/src/ios/CDVDevice.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m index 9225cbc..6b70fa5 100644 --- a/src/ios/CDVDevice.m +++ b/src/ios/CDVDevice.m @@ -47,7 +47,19 @@ - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device { - return [[device identifierForVendor] UUIDString]; + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; + static NSString* UUID_KEY = @"CDVUUID"; + + // Check user defaults first to maintain backwards compaitibility with previous versions + // which didn't user identifierForVendor + NSString* app_uuid = [userDefaults stringForKey:UUID_KEY]; + if (app_uuid == nil) { + app_uuid = [[device identifierForVendor] UUIDString]; + [userDefaults setObject:app_uuid forKey:UUID_KEY]; + [userDefaults synchronize]; + } + + return app_uuid; } - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org