База данных Sqlite3 не подключена в iPhone 4 под управлением iOS 5.0.1, как в Wi-Fi, так и в сотовых сетях. По этой причине мои приложения 4 раза отклонялись в магазине Apple Itunes.
Я использую XCode 3.2.4 с помощью iPhone 3.2 iOS 4.1. где это приложение работает хорошо.
Я пишу эти коды-
/// @ AppDelegate.m file
-(void)createDatabaseIfNeeded {
BOOL success;
NSError *error;
//FileManager - Object allows easy access to the File System.
NSFileManager *FileManager = [NSFileManager defaultManager];
//Get the complete users document directory path.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
//Get the first path in the array.
NSString *documentsDirectory = [paths objectAtIndex:0];
//Create the complete path to the database file.
NSString *databasePath = [documentsDirectory stringByAppendingPathComponent:@"passmanager.sqlite"];
//Check if the file exists or not.
success = [FileManager fileExistsAtPath:databasePath];
//If the database is present then quit.
if(success) return;
//the database does not exists, so we will copy it to the users document directory]
NSString *dbPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"passmanager.sqlite"];
//Copy the database file to the users document directory.
success = [FileManager copyItemAtPath:dbPath toPath:databasePath error:&error];
//If the above operation is not a success then display a message.
//Error message can be seen in the debugger's console window.
if(!success)
NSAssert1(0, @"Failed to copy the database. Error: %@.", [error localizedDescription]);
}
-(void)applicationDidFinishLaunching:(UIApplication *)application{
// createDatabaseIfNeeded method for first time to create database in new iPhone
[self createDatabaseIfNeeded];
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
}
И Ошибка дает Apple соответствие в коде на странице Некоторые ViewController
// @ viewController.m
sqlite3 *database;
int result = sqlite3_open("passmanager.sqlite", &database);
if(result != SQLITE_OK){
sqlite3_close(database);
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"Database Connected"
message:@"No"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
else{
// some stuff
}
Каждый раз, когда Apple жаловалась, что если Условие истинно как «База данных подключена Нет»
Пока в моей системе выполняется другая часть.
Пожалуйста, помогите мне. Такс в продвинутом.