How do I test code that runs on update for IOS apps? - ios

My app contains code that must modify the DB in the documents directory on update of the app (because the structure of the DB has changed between versions).
The loading of the new version of the app to a phone via xcode works fine, and runs the code correctly. However I'm concerned that this may not exactly mirror what happens when updating via the app store on the phone.
In order to properly test that this code runs correctly when a user updates their app through the app store, I gather it used to be possible to load the app via an ad hoc distribution, which would install it as if it were an update from the app store. The (rather old) instructions for that are here:
https://developer.apple.com/library/archive/technotes/tn2285/_index.html
I attempted this, by exporting the ad hoc .ipa file and dragging onto the device in ITunes, only for it to tell me the app is already installed. The .ipa file contains the updated app and it has a higher version number than the one installed on the device.
Do I need to do this another way? Or is loading the app via xcode sufficient to emulate what the user's phone will do when updating the app?
Thanks

Related

How can i export app file in Xcode

Do you know how to export app file in Xcode?
(like .apk file in android)
I want to send my testing app to someone for feedback.
i have never tried it before. please let me know easy way to export app file.
(not all project, only a file which can be played in another iPhone)
First Archive it (XCode->Product->Archive).
(For Archive button to be in visible state : either your device should be selected or generic ios device should be selected, incase any simulator is selected archive button will be disabled.)
A Window will appear :
Choose Export->AdHoc.
.ipa will be generated.
u can use https://www.diawi.com/ for uploading and send app to anyone.
I am posting a very late response to this old question in case anyone else finds their way here and infers that it isn't possible to export an app to your own iPhone or iPad without a developer account. That isn't true. I unearthed these posts when looking for an answer to the same question, and initially read them that way.
If you want to test an app you have written in XCode on your own iOS device you do not need a developer account. Provided the device you wish to test it on (or share it with) is physically nearby so that you can connect it to your macOS device to pair with it as a trusted device, it will remain paired when physically disconnected and accessible over a shared network by WiFi. You can build and run apps from XCode on to the iOS destination device and they will remain in place there and executable afterwards. There is a limit to how many exported apps there can be at one time, which seems to be 3.
Apple explain how to do all this here. You do need to have a registered App Store account, but that's the same one you use to buy apps and build projects in XCode, and it's free unless you want to distribute your app through the App Store.

Does installing an iOS app via TestFlight simulate an app upgrade?

I read in this Stackoverflow question that to simulate an app upgrade on an iPhone, you should install a new Ad Hoc IPA of the file via iTunes.
You can therefore check if the users data is still intact after an update.
I use TestFlight and quite often install new development versions of the app from there. Does this also simulate an app update?
You can test this by saving some data from the app, and doing the TestFlight upgrade. If the data are still there, then I think that shows that it does behave like an app upgrade.
When I did these sorts of updates, I think the data stayed, but I recommend testing to be sure.

Get app data from Appstore build

I want to be able to plug in any device that has my App on it and download the app data for my application. Is that possible?
I have a device that has the app store version of my application and I want to get the application data off of it.
I plugged in a device that is not added to my development account. I then add it to my dev account by going to Xcode organizer, selecting the device in the left-hand pane, and then clicking "Add to Member Center". After the whole process completes, I click Applications, but I don't see the existing app store version of my application available.
I then try to run my application on my device and it ends up deleting the existing App store version which causes all the data to be lost. Is there a way to get the existing app store app data off of the device?
===== edit ====
I'm looking to get the data manually, like I would if I had the app available as one of the options in the Applications tab underneath the device name in Xcode Organizer.

Testing app on iphone via xcode replaces my app (which is downloaded from app store)

I want to be able to have 2 versions of my app on my phone. The one that is published on the App Store and the one that i use to test on my iphone via xcode. Unfortunately when i run my app on my iphone with xcode, it replaces the one i downloaded from the app store.
Is it possible to have both versions?
Change Bundle identifier of your project to something else. You can find it at info.plist

Updating an ad-hoc installed iOS app

Hopefully a easy(-ish) one, but I'm just wondering if it's possible to update an ad-hoc over-the-air installed iOS app (deployed using the standard $99 developer license), hence ensuring that any data stored within the app's document sandbox is still available.
Additionally if iOS 4.x file protection is used (i.e.: the NSFileProtectionComplete encrypt attribute is set on the files, etc.) will an updated app still be able to read the files?
Whilst there are some existing questions that touch on this (such as Updating enterprise iOS apps while retaining some files of the current app bundle), these don't answer this specific query and (potentially) pre-date the newer style of ad-hoc distribution.
You can definitely update an ad hoc over-the-air-installed iOS app and retain the current app data -- it appears to work identically to normal update installation.
Because it works the same way as a normal update, file protection should work the same as well, though I don't have first-hand experience.

Resources