25

I was trying to test update scenario from live App Store app build to RC using TestFlight, but TestFlight gives me alert "You already have this app installed. Do you want to replace..." (see below screenshot). After confirmation, all data from App Store version is gone.

enter image description here

Steps I do:

  1. Install live app from the App Store
  2. Login and do some operations to get data in the app and Keychain
  3. Go to TestFlight iOS app
  4. Tap "Install" button in TestFlight -> alert "You already have this app installed" appears
  5. If I tap choose Install, new build is installed

Result:

  • The app's content including Shared Container (data shared with Extensions) and Keychain are completely wiped when I open the app again

Edit: The alert in TestFlight appears with any app (I have tried multiple different apps from different dev accounts). The actual data deletion happens only for some.

My question:

Is this expected behaviour from TestFlight or is it any issue with my app? I'm not aware of any changes between versions which could cause any issues.

I believe this was not happening before (the last time I tried was few weeks ago).

I couldn't find any documentation or release notes regarding TestFlight app behaviour or changes.

Did anyone experience the same issue? Or do you know any resources describing this behaviour?

Thanks for any answers!

Lukas Kukacka
  • 7,604
  • 2
  • 25
  • 50
  • I'm experiencing the same issue. – beny Dec 09 '15 at 12:22
  • And what then is the best procedure if you ***do want to keep and access*** the data from the app store version? For example, you want to read some preferences you've saved. – Fattie Mar 14 '16 at 21:38
  • 1
    @JoeBlow well this particular issue was happening because of `identifierForVendor` was changing. So if you want to be for example test update scenario of App Store version from TestFlight, just make sure you don't use `identifierForVendor` for anything where IFV's change could cause you data loss or that you handle that gracefully. – Lukas Kukacka Mar 15 '16 at 08:00

3 Answers3

27

After long research, trials and errors, creating radar and releasing update to App Store, I have an answer:

Alert is there always and does not have relation to losing data.

  • The alert with warning about possible lose of data is being displayed always for any app being installed from TestFlight over the Non TestFlight Build.
  • This was true for any of multiple apps I have tried.

identifierForVendor changes when overwriting app with TestFlight build.

  • When you have App Store version of the app installed and overwrite it with build from TestFlight, result of [[UIDevice currentDevice] identifierForVendor] changes
  • This is unexpected since it is not mentioned in the documentation (see below)
  • In my case unexpected change of identifierForVendor was causing "loose of data" which wasn't actual lose of data, but it is happening only for TestFlight builds which you cannot debug, so it was hard to find the issue.

Documentation of [[UIDevice currentDevice] identifierForVendor] says:

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. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution.

AsimRazaKhan
  • 2,154
  • 3
  • 22
  • 36
Lukas Kukacka
  • 7,604
  • 2
  • 25
  • 50
  • Damnnnnnnnnmmmmnnnnnnn!!!!!!!!!!!!!!!!! **Great find, Lukas**. Here's the thing: is there any way to install from TFA and **specifically not** erase the data? Because, of course, I want to be able to test if new systems work picking up old data. Did you ever find a way? Thanks! – Fattie Mar 14 '16 at 20:27
  • I did find this http://blog.xebia.com/run-your-ios-app-without-overwriting-the-app-store-version/ which may be related ... – Fattie Mar 14 '16 at 20:32
  • @JoeBlow Actually colleague of mine discovered that `identifierForVendor` is changing there, I just summarised all the findings here. – Lukas Kukacka Mar 15 '16 at 07:58
  • hi @lukasKukacka -- so I'm wondering, once the app went through to the appstore and actually updated normally from the app store - did you THEN lose the NSUserDefault data? or was it fine. thanks – Fattie Mar 16 '16 at 12:37
  • @JoeBlow No, this was case just when overwriting App Store version with TestFlight build (test update). `identifierForVendor` is changing only then. When updating App Store version with newer App Store version, everything is fine because IFV don't change in that case. But you are getting it wrong. `NSUserDefaults` data does not disappear, but `identifierForVendor` changes which was causing my loss of data. – Lukas Kukacka Mar 16 '16 at 12:47
  • Hi @lukasKukacka, thanks for that. Just to be clear. When updating **on TFA**. Regarding only `NSUserDefaults`. So, you are developing app "FunGame". bundleId is com.abc.fungame. You have on your iPhone FunGame, **from the app store**. You have some NSUserDefaults. Now, you install new version **from TFA**. You used same bundleId. You download from TFA - it overwrites FunGame with the new development FunGame. In fact, **do you get your NSUserDefaults**? Or does it erase them? **If you change `identifierForVendor`, does it then erase them? Or you still get them?** Thanks! – Fattie Mar 16 '16 at 13:09
  • @JoeBlow `NSUserDefaults` should remain untouched on update from App Store to TestFlight build. `identifierForVendor` is changed by system when the app is overwritten from TestFlight. Change of IFV is problem only if you use it in a way it's change could cause you loss of data (e.g. if you'll use IFV as a key in user defaults, then you will loose the value under that key because after the update the key raw value will be different) – Lukas Kukacka Mar 16 '16 at 13:22
  • hi @lukasKukacka - got it, thanks for that great information. I have one from a Unity3D app, and indeed I believe Unity add the `identifierForVendor` as a salt at their level. So it's just as you say. – Fattie Mar 16 '16 at 13:34
  • thanks for all the great info from your hard-won research @LukasKukacka . I clicked over a bounty :) Cheers... – Fattie Mar 20 '16 at 21:45
  • Thanks @JoeBlow I'm glad my painful research helped :-) – Lukas Kukacka Mar 21 '16 at 12:12
  • I was struggling due to this problem since last 4 days however I was skeptical about TF builds getting upgrade over appstore builds without losing data. Now we have saved the result of [[UIDevice currentDevice] identifierForVendor] in userdefault so that a future upgrade will not give same problem. – narangrajeev81 Jun 14 '17 at 13:12
1

as per best of my knowledge,

if you have installed application from App Store (suppose of version number 1.0) on your device, and lets say your are again downloading/installing same app with same version number 1.0 from TestFlight, you will get above message.

This is because you are trying to install app with same version and bundle id that already does exists on device.

Offcourse you will lose data/settings of app, as its replacing your app not updating.

I also gone through this scenario.

Avinash Jadhav
  • 491
  • 4
  • 17
  • hi @avinash ... BUT say you install version 2.0, actually from the app store. So, you have AngryBirds 1.0 and you click to upgrade to AngryBirds 2.0. Of course, **you do not lose your preferences**. Is that right? So, is it true that the behavior is different between "upgrading on app store" and "upgrading from TFA"? – Fattie Mar 15 '16 at 15:46
  • Yes, If you upgrade next version from app store, it won't loose data/your preferences. – Avinash Jadhav Mar 15 '16 at 15:51
  • 2
    Right. What I want to know is, is there a reliable way to update on TFA, and not lose the preferences. – Fattie Mar 15 '16 at 15:58
0

If you have the full version of an app installed on your device and you install the same Beta App, your app data may be corrupted or lost and may not be recoverable. You should back up your information before installing a Beta App.

http://www.apple.com/legal/internet-services/itunes/testflight/sren/terms.html


I don't know how this happens

huahuahu
  • 101
  • 2
  • 4