Problem description: when using the sqlite database in xocde, because there is no graphical interface, sometimes it is difficult to see whether there is a problem with your own database, for example, when I was just getting started with the sqlite Database Design id, I naturally used identify () (in fact, I should use primary key autoincrement). Finally, I can imagine that the id will never be assigned a value, however, it cannot be found at first.
Solution:
Method 1: Firefox browser has a plug-in called sqlite manager, many people like to use this plug-in: https://addons.mozilla.org/zh-CN/firefox/addon/sqlite-manager/
After installation, find and open it in Firefox's tool:
.
If you do not know the address of the database file, use the code to obtain the file path:
- (NSString **paths =*documentsDir = [paths objectAtIndex: [documentsDir stringByAppendingFormat:
You can use the NSLog function to output the file path, select the file path (note that the file path does not include the database name), and right-click it to open it:
You can also use a terminal (of course this method is somewhat complicated), because with the file path, it is easy to copy the database file to the desktop. Command Line: cp-R source file path/Users/aj/Desktop
Note that some folders have spaces, such as/iPhone Simulator. If you copy the obtained path directly as the source file path to the folder, the error "No such file or directory" is returned ". Remember to escape the space by adding a single quotation mark (') at both ends of the space, for example,/iPhone ''' Simulator.
Method 2:
Download SQLiteManager. This method is very easy to open the database in the project. It does not need to be as tedious as the first method. Select the output path (note that this time is the path + "database. sqlite ") directly Services --" Open ", because SQLiteManager is already the default program to Open the database.