Rename a app in itunesconnect - migrate data? - ios

I am about to submit a new app through itunesconnect. I read a couple of renaming questions (How to rename your app in itunesconnect?), but I have a more detailed question: would the user generated data migrate into the renamed version when I renamed it or would it start off from scratch again (this is exactly what I worry about - user data would be gone).

The user data is stored in the app container. The container ID is determined by the bundle ID. You're fine.

Related

Xcode migrate Core Data to new Bundle ID

I want to change my bundle ID (just make it lowercase) because the bundle ID I set up in App Store Connect is all lowercase, but my old bundle ID in Xcode had an uppercase letter. Changing it in Xcode is straightforward, but when I run the app on my device, it installs a duplicate app instead of replacing the old version (because the bundle IDs have different capitalization). I'm using Core Data for my data persistence, and since I've been testing the app on my own device for a while and adding data through that, I would really like to keep the data I have but migrate it to the app with the new bundle ID.
All the related questions I've found so far are concerned with only changing the bundle ID, but not with maintaining the existing data. Is there a good way to do this?
If you change the bundle ID, then it's a different app, as far as iOS is concerned. You have two different apps that happen to have similar bundle IDs, but they can't access each other's data any more than any two random apps can do that.
If you have not released your app, meaning it's still in development, you can copy data out of the old version and then upload it to the new version. You would use almost exactly the steps in this answer except that in your case you wouldn't delete the app until you were sure the copy was working normally. With these steps you basically copy the data from one version to your Mac, then copy it from the Mac to the other one.
If you have already shipped your app, it's more complicated. One way would be to update the app using the old ID but enable app groups. Have the update copy its data into the shared app group folder. Then enable app groups with the new ID and have it use the same shared folder. Another approach would be to have both versions sync data via some online service-- CloudKit, or Firebase, for example-- so that when the app gets the new ID it will get the new data by syncing it in.

Fetching previous saved database file after reinstalling the app

I am new to ios development so please pardon if I am asking a silly question.
I need to check if my sql file from the previous installation of the same app exists in the device directory already. If yes, then I need to fetch that file instead of making the new one. But the bundle folder of the app changes after reinstalling the app. So I cant guess the name of the previously installed app bundle folder. I tried to save it elsewhere on the device, but it isn't allowing me. Please suggest me the solution.
What you're asking for isn't possible. If an app is removed, all its files are deleted as well. In iOS, there is no app-neutral place to store files. When an app is merely updated, the update happens "in place" from the perspective of the app, and all previous files are available.
If you want files to survive a delete-reinstall cycle, you'll have to use a cloud service, such as iCloud, Dropbox or Google Drive.
once app is deleted. Application bundle and document directory and all files (including SQLite file)are deleted. u have to fetch all data from API.
In iOS each application is a Sandbox. This Sandbox consists of Application bundle and Mutable part where you store your database and other files which are mutated during the life span of an application.
When you delete the application, entire Sandbox is removed. The only thing which does not get remove is the data which you have stored in keychain.
When you update the application, only application bundle gets updated and Mutable part remain un-touched. So while re-installing the application when it is already present (technically updating the existing application on the device), you can find the same file from the same location.
You can do one thing you can take daily backup of that file on remote server and when you reinstall app check that file exist on server if exists than download else create new.

Getting to know if my app is updated from app store

I am going to publish a new version of my app on app store. I just want to know that if the app is being updated from the previous version or user has installed a fresh copy of the new version of my app. Based on this information i want to show some information to the updated users.
I was thinking of to keep a key in my NSUserDefaults of the previous_version but i haven't added any such key in the NSUserDefaults of my previous app version. So this key will be nil in both cases in my new version.
Is there a way i can get to know if the user has updated the app or installed a fresh copy of my app.
There is no direct way for it. Indirectly you can check it. If you are moving your editable data into Documents directory in your previous version then at the time of launching new application, you can check if the file is present in document directory. If you can find it, the application is opened after update and if file is not present then it has been opened because of a fresh installation.

Publish update-only distribution to Apple App Store

If I have an app that preloads a database when it first launches, is there a way to then in future publish an update only version for the app?
(IE excluding the preloaded db file so the update isn't bigger than necessary as an existing user wont ever overwrite their preloaded db - but at the same time being able to publish one WITH the preloaded db so that new downloaders will get a newer version of the db)
If there's an alternative way to approach it please let me know. Just to clarify, the app automatically updates the db with data when used - that's why I have no need to include the preload for every app distribution for users who have already downloaded.
I've looked on Google and can't find an answer - but maybe I'm just not using the right terms!
When you create an update to your application, your app will need to check if the user already have a database in the Document folder. If one doesn't exists, your updated app will copy the default database from the Application Bundle.
Also, if you add features to the app, new table or columns to your existing database schema it would be nice to use Core Data Model Versioning and Data Migration.
Excerpt from Apple Docs - Reducing Download Size for iOS App Updates:
Starting with iOS 6, the app store will automatically produce an update package for all new versions of apps submitted to the store.

IOS Enterprise Distribution update keep user data?

I'm making an iPad app which will be distributed from my own web server using Enterprise Distribution Program.
The app itself checks for a newer version on the server and calls itms-services in IOS to update itself. This works perfect.
The app bundle contains a directory with resources like images and movies.
Apple claims that updates will keep the users data if the bundle-identifier is the same.
From: http://help.apple.com/iosdeployment-apps/mac/1.1/#app43ad802c
If you want users to keep the app’s data stored on their device, make sure the new version uses the same bundle-identifier as the one it’s replacing, and tell users not to delete their old version before installing the new one. The new version will replace the old one and keep data stored on the device, if the bundle-identifiers match.
When running the app from Xcode directly to my connected iPad, I can remove the folder with my resources, run the app again, and the folder remains in the bundle on my iPad.
This behavior is what i look for. I'm planning on adding more folders with new resources with new updates. Since the resources are quite heavy, I don't want users to have to download bigger and bigger archives. I want to add just the new stuff.
The problem arises when I make a new archive without the folder and update the app from my web server as users would. Then the folder seems to be deleted.
Any experience with this?
The bundle that you install is always overwritten by the new bundle that you install. The user data referred to in the documentation is the data stored in the Documents and Library folders of the file system. If you wish to be sure that the old bundle files will always be available, you can copy them from the bundle to the Library/Caches folder of the application.
One thing worth mentioning is that the way to ensure that the ad hoc installation overwrites the current bundle is to make sure that you change the bundle version.
hope this helped :)

Resources