You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2012/06/27 20:33:51 UTC
[16/20] ios commit: Fixed CB-748 - refactored-UUID is broken and
changes over time (changed according to Apple's guidelines for this)
Fixed CB-748 - refactored-UUID is broken and changes over time (changed according to Apple's guidelines for this)
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/ddfc158f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/ddfc158f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/ddfc158f
Branch: refs/heads/master
Commit: ddfc158f734a23c30b61c3259e4f0fc747e95a01
Parents: 3088a0c
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Jun 20 12:15:41 2012 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed Jun 27 11:32:08 2012 -0700
----------------------------------------------------------------------
CordovaLib/Classes/UIDevice+Extensions.m | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/ddfc158f/CordovaLib/Classes/UIDevice+Extensions.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/UIDevice+Extensions.m b/CordovaLib/Classes/UIDevice+Extensions.m
index 140e20a..91c714b 100644
--- a/CordovaLib/Classes/UIDevice+Extensions.m
+++ b/CordovaLib/Classes/UIDevice+Extensions.m
@@ -24,11 +24,24 @@
- (NSString*) uniqueAppInstanceIdentifier
{
- // full path to the app folder
- NSString* bundlePath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
+ NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
+ static NSString* UUID_KEY = @"CDVUUID";
- // return only the folder name (a GUID)
- return [bundlePath lastPathComponent];
+ NSString* app_uuid = [userDefaults stringForKey:UUID_KEY];
+ if (app_uuid == nil)
+ {
+ CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
+ CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef);
+
+ app_uuid = [NSString stringWithString:(NSString*)uuidString];
+ [userDefaults setObject:app_uuid forKey:UUID_KEY];
+ [userDefaults synchronize];
+
+ CFRelease(uuidString);
+ CFRelease(uuidRef);
+ }
+
+ return app_uuid;
}
@end