0

Okay so I am trying create an IOS APP that uses a sqlite database so it can store the users username and can tell if he is logged in or not. The problem is I have also made an Android app that has a database. So when I open the command prompt for sqlite3 it already has me logged into a database. How can I leave this database to create a new one?

When I open the sqlite3 command prompt it tells me this message

Last login: Thu Sep 26 12:52:47 on ttys000
Bobs-MacBook-Pro:~ Bob$ /Applications/Android\ Development/sdk/tools/sqlite3 ; exit;
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

How can I leave the android database so I can create an IOS one??

user2779973
  • 1
  • 1
  • 5

2 Answers2

1

From Apple's sqlite3 man page:

To start a sqlite3 interactive session, invoke the sqlite3 command and optionally provide the name of a database file. If the database file does not exist, it will be created. If the database file does exist, it will be opened.

So you could do

sqlite3 mydata.db

and if mydata.db doesn't exist it will be created.

sqlite3 man page

You can also skip the command-line and create the database in code. See the answers here: How to create sqlite database programmatically

Or you could use CoreData,

Community
  • 1
  • 1
jcm
  • 1,781
  • 1
  • 15
  • 27
0

Try fmdb. If anything You don't like You always can rewrite this code as example.

HereTrix
  • 1,315
  • 7
  • 13