所以我知道你应该在主线程上进行更新。我正在使用 Apple 的代码来编写我们的数据库做文档目录:
// Creates a writable copy of the bundled default database in the application Documents directory.
- (void)createEditableCopyOfDatabaseIfNeeded {
// First, test for existence.
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"bookdb.sql"];
success = [fileManager fileExistsAtPath:writableDBPath];
if (success)
return;
// The writable database does not exist, so copy the default to the appropriate location.
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"bookdb.sql"];
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
if (!success) {
NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
}
}
我愿意
[activityIndicator startAnimating];
[self createEditableCopyOfDatabaseIfNeeded];
我没有看到我的活动指示器。如果我注释掉[self createEditableCopyOfDatabaseIfNeeded];
,我会看到我的活动指示器。有没有办法调试它以查看发生了什么以及为什么我看不到我的旋转指示器?谢谢。