This question already has answers here:
How to get a unique device ID in Swift?
(10 answers)
Closed 3 years ago.
I have to integrate a system in which I have to enter the device UUID manually to register the device into my database. And at the time of login if the device UUID match with the database value, only then the user can able to access the application.
Now my problem is that when I am fetching the Device UUID using iTunes it comes different and Programeticaly fetched value is different.
I am using the below code.
UIDevice.current.identifierForVendor!.uuidString
please let me know what I am doing wrong.
UPDATE:- Please read the complete problem before down vote :(
identifierForVendor is not the device UUID. You cannot programmatically access the device UUID. The only ID you are supposed to use to identify a device is identifierForVendor, which intentionally can change if the user uninstalls all of your apps. There is, intentionally, no fixed-to-the-device ID that you are permitted to access.
Related
This question already has an answer here:
Getting two different device IDs from same iphone
(1 answer)
Closed 5 years ago.
The backend apis I am using take unique device identifier and generate responses. In the client side, I am generating UUID for this unique identifier since Apple does not allow getting IMEI. I am storing the UUID (UserDefaults storage) and fetching it every time an api call is to be made. Now, my problem is that if the user clears the app data, the stored UUID gets cleared and a new id has to be generated. However, with this new id, the user request becomes invalid. How can this issue be resolved? Is there some kind of id that remains constant for a single device (something like device id in android)?
you can use the keychain secure storage to store the UUID, This will keep persisted even if you uninstall and then install the app.
Here is the 3rd party library written in Swift which simplifies the use of keychain.
https://github.com/evgenyneu/keychain-swift
By #Anand (Pls see the first comment).
Keychain is the actually good choice for storing UUID of the app in a secure manner, that can be persisted even when the app is deleted and re-installed. But in case, if the user resets the device for clearing the app data, even the keychain data will be deleted.
This question already has answers here:
How to preserve identifierForVendor in ios after uninstalling ios app on device?
(8 answers)
Closed 6 years ago.
I want to generate a unique ID for every user when the user uses the app for the first time. The login happens in the backend and user need not enter mail id or mobile number etc. So what is the best way to ensure that an unique ID is generated for every user? Also if user uninstalls and installs the app again that particular user should not be treated as a new user. How do I handle this situation? Please help...
Thanks
You should use UUID (not UDID). because as per apple guide line UDID can not use in coding. it will rejected by apple
But If use UUID than it will change after app will reinstall again. to solve this you have to save this UUID in keychain first time and have load from keychain every time you get
for this SSKeychain you can use.
You can make you unique key as well instead of UUID. that may be combination of your user detail like email and mobile num.
You can do something like,
NSUUID *myUUID = [[UIDevice currentDevice] identifierForVendor];
NSLog(#"uuid is %#",[myUUID UUIDString]);
NSString *deviceId = [myUUID UUIDString];
This will be unique.
This question already has answers here:
Programmatically get own phone number in iOS
(9 answers)
Closed 7 years ago.
all
I'm developing app and it contains function which gets phone number and email from device.
I've looked at some samples on internet but all of them are about unique id.
How can i get phone number and email from device?
Is there anybody who has experience in this area?
Apple has removed access to this data from inside your app. You may not access the user's phone number from the device. You instead must require them to enter it in a text field or something.
"For security reasons, iPhone OS restricts an application (including
its preferences and data) to a unique location in the file system.
This restriction is part of the security feature known as the
application's "sandbox." The sandbox is a set of fine-grained controls
limiting an application's access to files, preferences, network
resources, hardware, and so on."
The device's phone number is not available within your application's
container. You will need to revise your application to read only
within your directory container and resubmit your binary to iTunes
Connect in order for your application to be reconsidered for the App
Store.
This is not possible from the iOS APIs, you will need to query the user for phone number or discover it through other means.
This question already has an answer here:
iPhone 5s Touch ID sensor API [closed]
(1 answer)
Closed 8 years ago.
Instead of using the user object and password from ios keychain to authenticate in an app do developers have access to the user object's touchId. I do not want to store the fingerprint (and I know that apple will not allow this) I just want to authenticate using the fingerprint (touchid) that is encrypted on the hardware. I can't seem to find any subclasses or methods in the documentation that would allow me to perform the authentication using touchId rather than user and pass. Any insight would be great.
Thanks!
No, (at the time of writing) developers have no access to the touch sensor or any information from it.
It is possible only if you jailbreak.
This question already has answers here:
Programmatically get own phone number in iOS
(9 answers)
Closed 9 years ago.
I am building an IOS6 app which requires the user's phone number,
Is there a way to ask the user for permission and get the number in programmatic way?
Or he has to manually type it in?
I am using Xcode 4.5 if it matters..
You can't get the phone via any easy API within iOS. There might be a way to do it via the technique described in this related question, but this is a few years old and Apple may have closed this hole (which uses an undocumented key). I also wonder if Apple wouldn't allow the app on the App Store for privacy reasons. Probably not.
You'll have to trust the user to type in the correct phone number if you prompt him/her to.