Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by talha-1 · Aug 28, 2019 at 02:42 PM · Account Management

How to fix creating a new user on iOS every time app is uninstalled and installed again

Hello,

We are making a game in Unity, and for login we are using PlayFabSettings.DeviceUniqueIdentifier (which redirects to SystemInfo.deviceUniqueIdentifier for iOS).

Everything is perfect on Android. A player can uninstall the app, install it again, and they will login with the same user they were using before.

But on iOS, every time the app is uninstalled and installed again, it creates a new user. I vividly remember that this was not the case at some point, we were able to always use the same Playfab users on our test devices.

Here is the piece of code that could be relavant. If someone wants more info just let me know:

var deviceId = PlayFabSettings.DeviceUniqueIdentifier;
switch (Application.platform)
{
    case RuntimePlatform.IPhonePlayer:
    {
        var request = new LoginWithIOSDeviceIDRequest { CreateAccount = true, TitleId = _titleId, DeviceId = deviceId };
        PlayFabClientAPI.LoginWithIOSDeviceID(request, OnLoginSuccess, OnLoginFailure);
        break;
    }
    case RuntimePlatform.Android:
    {
        var request = new LoginWithAndroidDeviceIDRequest { CreateAccount = true, TitleId = _titleId, AndroidDeviceId = deviceId };
        PlayFabClientAPI.LoginWithAndroidDeviceID(request, OnLoginSuccess, OnLoginFailure);
        break;
    }
    default:
    {
        var request = new LoginWithCustomIDRequest { CreateAccount = true, TitleId = _titleId, CustomId = deviceId };
        PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
        break;
    }
}

Are we doing anything wrong? How can we fix this?

The issue resembles this: https://community.playfab.com/questions/15006/player-account-changes-on-ios.html

But in this one it states that as long as there are apps installed from the same developer on this phone it should keep the same device ID. In our case, we have our other app from the same dev account installed on this phone, yet, uninstalling still makes it impossible to get the same account on Login.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Sarah Zhang · Aug 29, 2019 at 06:55 AM

After researching, we found that Systeminfo.deviceUniqueIdentifier will not deliver the iOS Device's UDID. From the Unity side, a possible workaround is using Device.advertisingIdentifier to get the AdvertisingIdentifier. Be aware that the user can decide to change them in the iOS advertising Options. We refer to this thread from the Unity Community. You can also search such keywords on the Unity Community or Google for more info about how to get a unique identifier IOS in unity.

Comment
talha-1

People who like this

1 Show 3 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image talha-1 · Aug 29, 2019 at 01:52 PM 0
Share

This worked! Thanks a lot Sarah. It's weird that SystemInfo.deviceUniqueIdentifier returns something that changes so easily. In theory, advertisingIdentifier seems much more secure, I'd be surprised if a lot of users actually went to settings and changed their advertisingIdentifier.

avatar image Brandon Phillips talha-1 · Aug 29, 2019 at 04:58 PM 0
Share

We needed to rely on something that cannot be altered by the user, so we went with storing the initial UDID that the device provides on first install in the device keychain, and retrieve it from the keychain to login. Here's the open source keychain plugin for Unity that we're using: https://github.com/phamtanlong/unity-ios-keychain-plugin

If the application is uninstalled completely and then reinstalled, our app gets the initial UDID from the keychain and logs in to the initial account.

avatar image talha-1 Brandon Phillips · Sep 02, 2019 at 08:46 AM 0
Share

Thanks a lot for the tip! This will be our second option if advertisingIdentifier proves to be not good enough.

avatar image

Answer by talha-1 · Feb 10, 2020 at 02:27 PM

An update on this in case anyone is using this as reference: advertisingIdentifier created a problem for us on some phones that didn't allow this information somehow, resulting in one shared Playfab account for all those accounts with ID 00000000-0000-0000-0000-000000000000. Might be an iOS bug or might be an intended weird feature. Obviously a huge issue, for now we ended up checking if the ID is zeros, if so use the deviceUniqueIdentifier instead (which still has the problem of resetting on uninstall). Another solution is what Brandon Phillips mentioned with the keychain tool.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by peter-2 · Jun 23, 2020 at 04:28 PM

Just a note, if you are seeing an Advertising ID come through from IOS devices, it is because they have switches on a Privacy setting in IOS. Look in the Privacy Settings menu, under Advertising, Limit Ad Tracking. Turning this on sends 00000000-0000-0000-0000-000000000000 all the time. Hope this helps!

,

Just a note, if you are seeing an Advertising ID come through from IOS devices, it is because they have switches on a Privacy setting in IOS. Look in the Privacy Settings menu, under Advertising, Limit Ad Tracking. Turning this on sends 00000000-0000-0000-0000-000000000000 all the time. Hope this helps!

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Link cross-device with the same account 1 Answer

    Searching on non-unique title display names 1 Answer

    Facebook Friends added even if no Title ID... Master accounts with phantom game accounts... and more player profile craziness!!! 1 Answer

    Create non-recoverable account and link with recoverable account 1 Answer

    Can multiple users login with same CustomID? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges