IOS - Creating a database schema (only to run code)

I use FMDB for my iPhone App database, and I want to create a database and table schema only once.

How can I run the OBJC code when the user installs or updates the application?

Sincerely.

0
source share
2 answers

You can set the boolean value to NSUserDefaults- NSUserDefaultsonly reset when the user uninstalls the application, so you have code that executes if a specific boolean value is not found in the user defaults (and then saves that value after execution so that it does not start again) .

" " - , CFBundleVersion ( ).

+3

, - , . @lxt, , , .

. , "metadata" "properties", varchar, "name" "value". , ("database_ver", "1").

( ) "" . select database_ver from metadata; . , database_ver = 1 .

, , alter table database_ver. create table, "database_ver" "2" ( ) , alter table.

, . - , .

FMDB .

+1

All Articles