ユーザー名やパスワードなどでいっぱいのデータベースを持っています。しかし、ユーザーがアプリケーションを開くたびにデータベースの新しいコピーをダウンロードするか、インターネットを使用してデータベースの読み取り/書き込みを行う必要があります。最も実用的なソリューションです。
これは現在、ローカルでデータベースの読み取りと書き込みに使用しているコードです。これは主に、オンラインでデータベースの読み取りと書き込みに使用される関数とルールを作成することを目的としています。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
databaseName = @"UserDatabase.sql";
// Get the path to the documents directory and append the databaseName
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];
// Execute the "checkAndCreateDatabase" function
[self checkAndCreateDatabase];
[self readNamesFromDatabase];
// Query the database for all username,pass,email records and construct the three different array's for each.
[registerForm setHidden:YES];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
前もって感謝します!