0

I just learned the basics of integrating SQLite3 into an iPhone app, but I still don't really know where or when to use it. Is the SQLite database just locally created on the device or will every app have its own database? If I for example want an app where the user can upload a recipe to the database, will other devices be able to fetch that recipe from the database or do I need something else to make that such of app? Sorry for the noob question but I can't find an answer..

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Wilhelm Michaelsen
  • 665
  • 14
  • 32

3 Answers3

2

Your app will have its own sqlite database. Your app can have 100 sqlite databases if it wants. It's just a file like any other file your app works with. It will be specific to your app in your app's sandbox. It will not be shared across devices. Just like any other file.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
2

An SQLite database, in iOS, is stored locally. That means that every iOS device has his own independent SQLite database.

Usually, in the case of the recipe you mencioned, you need a backend to sync information with other devices. You can update your SQLite database or just browse the information without a SQLite database behind.

Aditionally, in iOS you have one tool under your belt that it can be used to persist information locally : Core Data. There are some tools that can be used to sync core data information with a server like Parse.

Tiago Almeida
  • 14,081
  • 3
  • 67
  • 82
1

A SQLite database is just a file that you would put in your app's directory, and iOS apps are sandboxed so that one app can't read the files of another app.

If you need to share data from your app, you can have your app implement a URL prefix, and you read the data in your app, but share it using the system defined mechanism. Have a look here, here, and here for more guidance on the subject.

Community
  • 1
  • 1
Joshua Frank
  • 13,120
  • 11
  • 46
  • 95