Our iOS application is for specific users. So, we used device unique identifier for user identification. This approach works fine till iOS 6, because we are getting the same value every time.
NSString *strUniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];
In iOS 7, the above method is returning different values and we are getting issues in user identification. iOS 7 provides the following alternate.
NSUUID *oNSUUID = [[UIDevice currentDevice] identifierForVendor]; [strApplicationUUID setString:[oNSUUID UUIDString]];
We replaced uniqueIdentifier
with identifierForVendor
, and created an Ad-hoc build. We then installed the build on both iOS 7 and iOS 6 devices. So far in iOS 7, we are getting the same value every time, but iOS 6 gives different values every time we delete and reinstall the app.
Every iPhone, iPod touch and iPad has a unique identifier number associated with it, known as a UDID (Unique Device ID). Your UDID is a 40-digit sequence of letters and numbers that looks like this: 00000000-000000000000000.
A universally unique value to identify types, interfaces, and other items.
To generate a new device ID for iOS, you must factory reset your device. Go to Settings > General > Reset > Reset all Contents and Settings (the device will now effectively be restored to factory settings). Reinstall your app, open it and test the Push Pre-Permissions.
Use this little helper method to keep identifier in Keychain between install/delete sessions of app
-(NSString *)getUniqueDeviceIdentifierAsString { NSString *appName=[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; NSString *strApplicationUUID = [SSKeychain passwordForService:appName account:@"incoding"]; if (strApplicationUUID == nil) { strApplicationUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; [SSKeychain setPassword:strApplicationUUID forService:appName account:@"incoding"]; } return strApplicationUUID; }
Add the SSKeychain library to your project, e.g. via Cocoapods with pod 'SSKeychain'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With