Uniquely Identifying an iOS User

Uniquely identifying an iOS user

The correct solution is to use the iCloud Key-Value Store, where you can store a unique user ID without requiring any kind of authentication or user information such as an email address.

The end result is a random UUID (nothing that actually IDENTIFIES the user), that is different for each user, but will persist across multiple devices registered to the same iCloud account.

We define a field in our iCloud KV Store, let's call it userID. When the app is launched, we first check the userID. If it's there, then we're all set with our user's unique ID. If not, then this is the first time we're running for this user. We generate a random UUID and store it in the KV Store under userID. That's all there is to it.

Our experience shows that this UUID is unique per iTunes account. If your end-users are using family sharing, those accounts will be assigned different UUIDs (which may or may not be desirable but there's nothing you can do about it). Any number of devices launching under the same iTunes account will see the same UUID.

This approach is totally legit and should be approved by Apple with no issues.

Obviously you must enable iCloud Key-Value store on Xcode under Capabilities, just turn on the iCloud Switch.

Here's a simple class that implements this concept in Objective-C:

@implementation EEUserID

+ (NSUUID *) getUUID
{
NSUUID *uuid = nil;
NSString *uuidString = [[NSUbiquitousKeyValueStore defaultStore] stringForKey: @"EEUserID"];
if (uuidString == nil)
{
// This is our first launch for this iTunes account, so we generate random UUID and store it in iCloud:
uuid = [NSUUID UUID];
[[NSUbiquitousKeyValueStore defaultStore] setString: uuid.UUIDString forKey: @"EEUserID"];
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
}
else
{
uuid = [[NSUUID alloc] initWithUUIDString: uuidString];
}

return uuid;
}

+ (NSString *) getUUIDString
{
NSUUID *uuid = [self getUUID];
if (uuid != nil)
return uuid.UUIDString;
else
return nil;
}

+ (void) load
{
// get changes that might have happened while this
// instance of your app wasn't running
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
}

@end

And for the header file:

#import <Foundation/Foundation.h>

@interface EEUserID : NSObject

+ (NSUUID *) getUUID;
+ (NSString *) getUUIDString;

@end

To use, all you have to do is invoke:

NSString *uniqueIDForiTunesAccount = [EEUserID getUUIDString];

Enjoy.

How can you uniquely identify an iOS device?

The closest thing we have to the uuid is the vendor id now

How to identify iOS device uniquely instead of using UUID and UDID

Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification.
Source: TNW

What you are looking for is Vendor ID

easiest way to uniquely identify a user of an iphone app

Maybe email address and password?

If you use Push Notification the user's device will have a unique token to all communication with your App. Maybe you could pull that token, then just not actually send the notification. Although the user has the option to deny the request, so you'd need a backup.

How to identify unique users without using a login system (iOS)

After a while we decided that it was either unreliable, impossible or really annoying to get unique user ID's without asking them to fill some kind of field and actually sign up.

We therefore decided to use their encrypted formatter phone numbers using the following process :

  • Ask for phone number & international code* (+1, +32, etc.)
  • Verify integrity of phone number programatically
  • If satisfactory, ask user to verify with alert
  • If okay, send pin code and wait for validation
  • If valid, signup to database.

The user's username is : formatted phone number (+32495555556 for example), and that string is then hashed in SHA-256, and finally we save that super-long string to the database and recognize everyone like that.

If you have any question please ask here so I can give some clarification. If you have a better idea I'd still be glad to hear it.

Best way to uniquely identify iOS device?

Starting iOS 7 deducing MAC address isn't possible. You can, however, use below:

[[[UIDevice currentDevice] identifierForVendor] UUIDString]

Per Apple Documentation:

The value changes when the user deletes all of that vendor’s apps from
the device and subsequently reinstalls one or more of them. The value
can also when installing test builds using Xcode or when installing an
app on a device using ad-hoc distribution. Therefore, if your app
stores the value of this property anywhere, you should gracefully
handle situations where the identifier changes.



Related Topics



Leave a reply



Submit