Unique identifier for device which can be visible for both user and programmer iOS 8? - ios

I went through almost all the related SO questions, googled lot, but I can't get help.
There are lot many posts and SO answers which states to use [UIDevice identifierForVendor], but as this Id is not visible to user, I want different way to uniquely identify the device.
Basically I am developing Enterprise app which will not going to App Store(no need to worry about private APIs).
I am having server which has all users details including device id(don't know what to use as device id) already entered.
When device launches app, web service will be called and it needs to send device id to authenticate the device.
That's why I need device id which will be visible to user as well as programmer.
Any help is appreciated!!!
Update
'Visible to user' means user can see this unique id before installing app, so as he/she can send this number to admin to register it on server.
If this unique id is registered on server then and then only access will be given to application, otherwise app will not connect to server.

Use
NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSLog(#"UDID:: %#", uniqueIdentifier);
You've to put a small case to check the app is running on simulator or on device.

You can no longer get a unique ID of device. "identifierForVendor"
is the best you're going to get. Apple has systematically disabled
identifying a specific device.
Though, "identifierForVendor" value also changed after every new installation of application.
for more info visit.
You're also confusing me with this line "visible to user", could you please be more specific about it?
There's also one more way - Using icloud kit you can get a unique token of currently logged In icloud user account. This is unique per application on device.
It seems you want to track user using unique ID or UDID and Apple doesn't like this so before moving forward please visit.
Update:
If Apple is preventing tracking users using Unique Id, you shouldn't be using it then.
You simply want to validate user on your server. The best solution for you is iCloud token,
Fetch it and store it in User defaults or Keychain and use anywhere you want.
In this way you can also track single user on different devices if he/she is using multiple devices with same iCloud account.

You can try obtain UDID of device via service http://get.udid.io and then authenticate this device on your server.
But after this you will need to obtain the same UDID in your apps to pass it to server... It is possible to pass UDID to app via specific URL schema.
What do you think about this idea? I can share more details if you like it.

Related

How to stop users from using an app over two devices?

I have an iOS application in which i am using Facebook login, and after that phone verification is done which lets the user continue with the app. I ask for phone verification only once when user is being registered.
I wanted to ask if there is any way i can stop users from using the app on two devices? because application records user's footprints(location) and current location, if users use the app on two devices, locations updates will be made by both devices and there won't be any way to tell which location belongs to the user?
Can i use UUID or some other identifier?
You are not allowed to use the UUID. But you can generate a vendor id. But you will need to check if the user already uses on device on some kind of server and let the App ask if it is allowed to run.
But keep in mind that Apple doesn't like such things.
Well, I had to do a similar thing once. The app used to have in app purchase of number of device it can run for a single user. What I did was:
I used to take the UUID of the device while signing in to my app and send it to server.
In my server side database could store the UUID against a user. Whenever a user tries to sign in I used send the UUID with the sign in request.
If the UUID was present then I return success response otherwise I used to check the number of device allowed for this user. If adding this device exceeds the limit then I used to send failure response. Otherwise used to insert the UUID against that user and return a success response.
Suppose if a user deletes the app from a device and want to login from another device. Then display a popup like "Do you want to change the device?" If he/she say Yes then I used to update the UUID and allow him/her to use the app in this device. And every time the app starts (new launch or from background) I used to check the UUID against server's UUID.
You can design your own system but using device UUID gives some extra benefit. like you don't need to store the UUID anywhere and you can rely on its uniqueness.

Is it possible to obtain an unique iCloud user ID on cocoa?

My iOS app is currently on beta in TestFlight, and as a way to retribute to the nice people who helped me test it I would like to offer them some goodies such as, for instance, the full final version of the app for free.
For this, I was thinking of sending them a last beta version which would, automatically and upon execution, store some kind of ID from the logged in user into a VIP list I would keep online and then every next version of the app would check for their ID in order to verify if the user is a VIP user and unlock all the premium features.
Is it possible to obtain in the Cocoa apis a unique identifier that is associated to the user (as opposed to the device unique identifier)? I want this because I want to recognise the user in whatever device he installs it. I would like to avoid having to make my beta testers manually register as VIPs.
Thanks!
Yes, this is possible using CloudKit. You'll need a CKContainer, and you'll ask it to fetch the user record ID. That record ID is unique for your apps, but is also stable for that user this means the same iCloud account will have the same record ID, regardless of which device they're running on or which of your apps they're using.
If you turn on the CloudKit capability for your project, Xcode will automatically create the iCloud container for you, and you can then access it using one of the two CKContainer constructors.

iCloud, iCloudKit, iOS 8, Apple id

As I understand it now can not get apple id in iOS 7.
iOS 8 has many edits to work with iCloud and adding iCloudKit. Will I be able to get Apple id from API and use it, for example, for registration in own server?
No, you cannot get the user's Apple ID.
What you can do with CloudKit is get an opaque user record ID. This object will be the same for the user for your app on all of their devices, but it will be different for other apps or other users. You can save that on your server and use it as something like a "log in with CloudKit" feature. This was described in the WWDC 2014 intro to CloudKit session. Basically, you use the fetchUserRecordIDWithCompletionHandler: method on CKContainer. But there's no way to link this to the Apple ID automatically-- you still need to ask the user if you want that.
Not that I am aware of. That's kind of "invading" the user's privacy because you'd be getting his Apple ID (which is an email) without his consent.
What I do, using Parse SDK, is to make the user log in anonimously at my Parse App, then save his automatically generated User ID in a iCloud Key-Value container. Whenever the user deletes the app and reinstalls it (or simply install in another device of his), my app knows that he has an username saved on iCloud and then uses that instead of creating a new user. This way, I get to keep track of my users without invading nobody's privacy.

iCloud unique identifier

I'm trying to learn about iCloud. I've read that there's
ubiquityIdentityToken and it's used to determine if iCloud is available or if the user changed the account signed in. Also, this is only available in ios 6+
But what i need to know is the unique data for every iCloud user. What i'm saying is, after the user logs into iCloud, is there a way for us developers to know who that persons is/who the account belongs to like a username or id (similar to Facebook's fbid/identiferForVendor)? Could we even get the iCloud account of the user in code?
The reason why I want to know this is because i want to check if it's possible to use the user's iCloud account(or whatever unique data we could get from them) as the user's unique identifier on our server.
I hope I could get some answers. Thank you so much!
You can use CKContainer.fetchUserRecordID(completionHandler:)
Returns the user record ID associated with the current user.
https://developer.apple.com/documentation/cloudkit/ckcontainer/1399191-fetchuserrecordid
This article shows example of practical usage of record ID retrieved in this way: Onboarding without Signup Screens.
Apple don't want you to do this. That is why they give you a unique token that is opaque. You can't use it as an id on your server. Apple do not allow iTunes accounts to be used in that way at this point in time.
I suggest you use your own account names, or you use accounts from Facebook or Twitter, which are accessible via system APIs on iOS.

What can I use as a permanent alternative to UUID?

Here is my situation and problem. I have an app that is used by a commercial company. They give their workers a phone with our app installed on it, the workers might swap phones (i.e. first come first serve; grab what is available).
The company needs a way to identify each phone in case it stolen and to use for inventory, but from our app. Our solution gives them a way to remote wipe the app should the phone be lost or stolen. Since we cant use the UUID, per Apple, we not sure how to identify the phone for wiping. I know there is a temp way to sue a temp UUID, but that temp UUID has the ability to change or be reset by Apple or another app on the phone. So if that UUID get change out from under us we can't wipe it or identify it as the new change UUID would be passed up.
The other issue with us generating a unique ID of our own when the app is installed is that if some uninstalls our app and reinstalls, for whatever reason, it will create a new unique ID on the backend. Now we have to ID's on the backend for the same phone, so inventory will show one extra phone.
We can't trust the companies to always be sure to wipe out the old ID should they reinstall the app.
Any suggestions?
about the unique identifier, generate a UUID and saved it in Keychain
Apple has OS X Server has a function to manage remote devices, it's very useful for enterprise. such as manage VPN settings, wifi settings,distribute apps, remote wipe if stolen. You should research MDM.
if your iPhone is stolen you can do nothing in your app.
Best idea I know about is to include AdSupport and do this:
NSString *uuid = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
NSUserDefaults can persist this across app updates. Not sure across uninstalls. For that, you might need user identity and storage off the device.
Following code will help you to get unique alphanumeric value which will be same for apps that come from the same vendor running on the same device
Which means if you 5 Apps. published , all of them will return you a same unique value on a particular device.
[[[UIDevice currentDevice] identifierForVendor] UUIDString]
Please find the Reference at Developer Library
Other solution would be to use OpenUDID.
Third Solution is as below:
When App. Launches for the first time, create your own unique id from "CFUUIDCreate"
Save this with NSUserDefault in Cloud.
So, now if the app is uninstalled it will still have same id for that user when fetched from the Cloud.
In case phone is reset, you will still get the same ID unless and until cloud account is changed.

Resources