iosswiftuikituidevice

UIDevice.current.name returns wrong value


Maybe I am wrong, but look at that:

enter image description here

But as you can see:

enter image description here

Shouldn't it return Sprytny Sid?


Solution

  • In iOS 16 and later the user assigned device name is not available without an entitlement from Apple - com.apple.developer.device-information.user-assigned-device-name

    You need to apply to Apple for this entitlement and there are criteria that you must meet:

    • The user-assigned device name is visible to the user in your app’s UI. You must provide screenshots of this UI to request the entitlement.
    • The user-assigned device name is powering a multi-device feature.
    • Your app uses the user-assigned device name solely for functionality that’s visible to the user so that they can identify their own device, and the functionality involves interaction between multiple devices that the same user operates. For example, an app that has multi-device syncing functionality might show the user-assigned device name for each device so that the user can select between them. You must provide screenshots of this UI to request the entitlement.
    • The feature using the user-assigned device name is available to all or the vast majority of users. The feature provides an important component of your app’s functionality to a majority of your app’s users.
    • Your app doesn’t use the user-assigned device name for tracking or fingerprinting. You’re responsible for all code in your app, including any integrated SDKs. For more information about tracking, see Tracking and for fingerprinting, see User Privacy and Data Use.
    • Your app doesn’t share the user-assigned device name with any service providers or third parties other than cloud hosting service providers. Prohibited third parties include, but aren’t limited to, third-party SDKs, ad networks, and mobile measurement partners (MMPs). There’s an exception for cloud hosting service providers for the purposes of storage or syncing only.

    If your app meets the criteria, you can request this entitlement at User-Assigned Device Name Entitlement.