How to persist data between xcode builds? - ios

I'm actually developping an iOS Application and I'm facing a problem. In my application I have to store two kind of data : a product catalog, and a user preferences list on these products.
The catalog is a sqlite database and I need to update my catalog product at every build on xcode. No problem for this one I've added the file in the "Copy Bundle Resources" of the "Build Phases" of my project. So every time I build my application on xcode, the iPhone gets an updated database.
My problem is : I'd also like to store user preferences on these products that have to persist between xcode builds.
Question :
Is it possible to do something like this?
If yes : How? Is it possible to store this data in a sqlite database? What kind of file architecture am I supposed to implement to do something like this?
I've actually made a lot of research on this subject, but I can't find a solution...
Correct me if I'm doing it wrong, but I think this is possible.
Thank you :)

I've found a solution. The thing is, I think it is possible to realize something like I described before but I don't know how to do it. I'm still interested in the solution if someone have it.
The solution is to decentralize databases by using Firebase. By using Firebase database solution I can persist data through xcode builds.

Related

When should I increase xcdatamodeld version?

someone please explain when should I increase the xcdatamodeld version? I google a lot, there are all about migration, but when should I increase the version?
Currently if I make change in my xcdatamodeld such as add entity or add attribute, I will recreate nsmanagedobject subclass. But I am not sure what situation that I have to increase the xcdatamodeld version.Please someone explain it. Thanks!
I think of it as a tool for helping users of my app migrate from the previous data model to the new data model. So I don't bump the version up unless I have to "release" it in some fashion (app store, or internal testers). Even then, if I have a small group of testers, I may just tell them to delete and reinstall so that I don't have to muck with it.
If a user with the old data model installs your app update with a new data model, they will crash unless you instruct the data model to "migrate".

Correct way to remove Apple Watch Glance view from final build without deleting it from project?

Is there a way to make a app store build without WatchKit Glance view while project still have glance files so they can be used later?
All other related questions in Stackoverflow suggested deleting glance files, but I still want them in project to develop later. What is the best practice?

The model used to open the store is incompatible with the one used to create the store Xcode 7.1

I created a core data model that was working fine until I added a new entity to the model, my code is fine I think... because Xcode can't detect any errors, but as soon as I run my app on the simulator the compiler gives me an error saying
reason=The model used to open the store is incompatible with the one used to create the store
I don't quite understand what this error means. I did search for references regarding this error but the one I found is outdated it was from Xcode 3.2, I'm currently running Xcode 7.1.1, interestingly enough there's no check mark on none of the replies. Despite that I still tried to use some of those methods and nothing has worked.
Things I tried
Resetting iOS Simulator -> Reset Contents and Settings...
Deleted the [Simulator App Folder]/Document/*.sqlite and ran the project
Have you had the same problem? If so can you help me troubleshoot it? Thanks.
That error means that you changed the model so that it doesn't match the one you were using when you created the app's data. It's the classic sign of changing a data model and not either doing model migration or deleting the app from the phone/simulator (and it's been pretty much the same as long as Core Data has existed, so old information is not irrelevant). Deleting the app from the simulator would normally be all that's needed to run the app again. If it's not working, then you're somehow leaving old data in place.
The best way to delete an app from the simulator is usually the same as you'd delete an app on a real device-- click and hold until the app icon starts moving, then click the "x" on its icon to delete it.
If deleting the app doesn't help, you're using old data some other way. Maybe you have some pre-loaded data built into the app that was configured using an old version of the model?
My favorite solution is to open the sqlite database with a third party app, then open the Z_MetaData table and delete the row found in there.
Works like a charm every time.
It may affect your 'migration' if you do migrations.
We do not, so not an issue.

Best way to rename an app in Xcode 6.3?

Every time I select the Target(the app), then change the app's name in Identity and Type, Xcode crashes. Is there a good way to change the name of an existing app? Thanks
I was looking into a solution for this a few days ago, and unfortunately I think there's no straightforward way to rename a project. What I ended up doing, because I hadn't done much in the project, was to create a new project with the correct name and then copy the files I needed, such as the storyboards, class files, etc.

Reuse Xcode project for new app

Similar questions have been asked before, but I can't find the specific details I'm looking for. I have an Xcode project which has been completed and submitted and is on the App Store. I want to make a similar app for release in a different country. To avoid complications, I want to use a fresh project in which to make the changes. I intend to make a copy of the original project, tweak it, and then release it (this is not about language so localization is not the answer).
Because Xcode is doing so much complicated stuff under the hood, and because I'm unsure of exactly which details are being validated when submitting to the App Store, I don't know which details I need to change to ensure two separate projects on my Mac and two separate apps in iTunes Connect.
Obviously I will need new provisioning profiles for the new project. What else do I need to change once I've duplicated my project? The bundle identifier maybe? Anything else? Any advice much appreciated.
The thing that must change between projects is the application ID (or bundle identifier, as you called it).
And yes, when you change the application ID, you do need to create new provisioning profiles to go with it.
If you're feeling really ambitious, you can use the exact same project as your original one and merely create a new target (and application). That way any code changes you make to one can be picked up by the other and the differences would be the ID and maybe the localizations/resources used in each app. Here is a related question that talks about that.

Resources