Ios 捕获损坏的MapBox文件(.mbtiles)的错误

Ios 捕获损坏的MapBox文件(.mbtiles)的错误,ios,objective-c,xcode,mapbox,Ios,Objective C,Xcode,Mapbox,我在捕获损坏的.mbtiles文件的异常时遇到问题,该文件需要MapBox。如果文件已断开,则在初始化MapBox视图时: self.mapView = [[RMMapView alloc] initWithFrame:self.frame andTilesource:self.tilesStandard]; 我得到一个错误: 调用sqlite3_步骤(11:数据库磁盘映像格式不正确)时出现未知错误 我能做些什么来捕捉这个错误 更新:我通过使用SQLite库直接打开MBTILE来测试它,解决了

我在捕获损坏的.mbtiles文件的异常时遇到问题,该文件需要MapBox。如果文件已断开,则在初始化MapBox视图时:

self.mapView = [[RMMapView alloc] initWithFrame:self.frame andTilesource:self.tilesStandard];
我得到一个错误: 调用sqlite3_步骤(11:数据库磁盘映像格式不正确)时出现未知错误

我能做些什么来捕捉这个错误

更新:我通过使用SQLite库直接打开MBTILE来测试它,解决了这个问题,正如建议的Ingaus

- (BOOL)isReadableDatabase:(sqlite3 *)database {
   BOOL result = YES;
   sqlite3_stmt* statement;
   char * errmsg;
   NSString *query = @"SELECT name FROM sqlite_master WHERE type=\'table\'";

   if ( sqlite3_prepare_v2(database, query.UTF8String, -1, &statement, NULL) == SQLITE_OK ) {

      while(sqlite3_step(statement) == SQLITE_ROW ) {
         NSString *tableName = [NSString stringWithCString:(const char *)sqlite3_column_text(statement, 0) encoding:NSUTF8StringEncoding];
         NSString *query_table = format(@"SELECT * FROM %@", tableName);

         if (sqlite3_exec(database, query_table.UTF8String, NULL, NULL, &errmsg) != SQLITE_OK) {
            DLog(@"The map is corrupted with sql error: %s", sqlite3_errmsg(database))
            sqlite3_close(database);
            result = NO;
            break;
         }
      }
}

   sqlite3_clear_bindings(statement);
   sqlite3_finalize(statement);

   return result;
} 

我建议您尝试直接使用FMDB或SQLite库来打开MBTiles以首先进行测试。在将它们传递到更高级别的库之前,这两个库都应该有调用,让您确定事情是否成功