2

I am running different apps with same API in same device. But different UUID going to server. How can I send same UUID both apps with same device and API. how can I resolve this. I want same UUID in same Device with different apps.

Different UUI's are here:- 1: 0D0B5F8F-9D4D-44E6-ACA2-DF9DA634FA53 2: 738927AD-C795-4C4C-9D41-AB0FCD7357E1

let imei = UIDevice.current.identifierForVendor?.uuidString Print(imei) 
1

2 Answers 2

5

Here're some useful excerpts from identifierForVendor documentation:

  1. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID. The bundle ID is assumed to be in reverse-DNS format.

    On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used.

    On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used.

For example, given bundle ID com.example.app.app1, on iOS 7.x+ com.example.app will be used to calculate vendor ID (omitting only the last component). Since you're probably targeting iOS 7+, please make sure that your apps' bundle identifiers differ in the last component only.

  1. Another thing to keep in mind is the following:

    The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them.

Sign up to request clarification or add additional context in comments.

1 Comment

It possibly bears stating explicitly (this answer hints at it, but never states it): You should not be generating your own UUIDs directly. You should be using identifierForVendor for the purposes of identifying yourself to the server. identifierForVendor is exactly the tool Apple designed for this purpose.
0

When you reinstall the app the id provided by the UIDevice.current.identifierForVendor?.uuidString gets changed.

You can use Device Check API introduced in iOS 11, if you want to identify user's device even if user reinstalls your app.

Your server can use the generated token on the apple device. for more details please refer the following documentation

https://developer.apple.com/documentation/devicecheck/dcdevice/2902276-generatetoken

Comments