Hello,
I am trying to get the name of the user on iPhone without having any user data stored in the application. I would like to display the user name on the summary screen. Using the NSUserName & NSFullUserName return Mobile and Mobile User instead of the actual user name. Please help if there is a way to implement it in Swift.
The behavior of NSUserName and NSFullUserName are platform-specific, as they return the details of the logged-in user.
On macOS, where the user logs in, they behave as expected.
On iOS, there is no login, so there is no logged-in user (so no user name).
On iOS, there is no publicly-available API to return the user name.
You will have to ask the user to input their name.