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

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.

Related

IS storing data without user signing in on flutter app possible?

I'm making a card game for apple appstore that consists of 5 decks, 2 of them being free to play and 3 of them needed payment to be unlocked. I am not currently planning to do a login for my app. Would there be any way for me to track whether or not the user has paid and unlocked a particular deck?
If you want to detect if user bought something and you need to do it in different devices and even in the same device if user uninstall / install again, you'll need to implement a sign up strategy.
If you don't care about cross device, cross installations.. then you could generate an installation id that you're sure to be unique and send it to the server the first time the app is opened and use that to identify activity on that device/installation in the future.
You could use a uuid or any other identifier that you know that won't be used by anyone else.
So the flow would be:
App opened for first time
Generate installation id
Store it locally
Send installation id to server
Send it in the future to identify current installation

Can I persist a User ID for an anonymous user when they upgrade to a new iOS device?

I'm looking for a second opinion on an issue.
Scenario: A iOS app user is issued a unique ID upon first launch by a backend platform. Consider this ID to be roughly sequential - or at least not derived anything device-specific - and anonymous. The user has not "logged in" in any way, but may have explicitly provided some information that is being stored platform-side related to this ID.
Now, the user buys a new iPhone, and restores a backup of their previous device to the new device. I'm being advised there is no way to persist that unique ID to the new device, and thus link them to the stored platform data. That the only way this could work would be to have the user specifically provide a "login" function before the new device, and then use that same login to associate the user to their ID in the platform.
Is there really no way to persist a simple piece of data across a device upgrade in iOS anymore? thanks in advance for any tips.

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

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.

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.

How to approach auto login across multiple ios apps?

I am implementing the feature of automatically logging in the user in an iOS app. This is easy for a single app as we can persist the username with NSUserDefaults while the password using System Keychain.
Now, I want to do it across multiple apps. In my understanding, we'd need a unique device identifier for this, which we can pass to the server and then use it to activate auto login across multiple apps on the same device. Now since, Apple prohibits the use of UDID now, I am thinking of using the Vendor Identifier which would of course require me to set the Bundle IDs accordingly. Is this the best way possible? Or is there a better standard method that is more effective?
Also, Is it at all possible to have auto login between different devices? Like for e.g. If I login on one iOS device and then open the app in another, I should automatically sign in.
To implement login between multiple iOS apps you can use the same App ID prefix in them. It will work because they will share keychain data. Here you can find more details:
https://developer.apple.com/library/ios/technotes/tn2311/_index.html
And here the related question: Keychain group access to share data between my existing applications
And about automatic sign in between different devices. I used encrypted iCloud Key Value storage to store login & password between devices. And it worked but not too good. Problem is that first time you start app on new device it will take some time to sync data from iCloud to local storage. And this means that first time you trying to Sign In and may need to wait for some undefined time. In may case it was about 20 seconds. To long for Sign In in a good application :) And of course this require user to be logged in iCloud with the same Apple ID.
ASAIK there is no proper way to implement automatic Sign In from multiple devices. And Apple recommend just to ask for Sign In on every new device of user.

Resources