DB Error: 26 "file is not a database" FMDB with SQLCipher

1.1k views Asked by At

Hello I am trying to open password protected database file. I ma using FMDB/SQLCipher. I am getting error file is not a database.

        rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0);
if (SQLITE_OK != rc) {
            if (_logsErrors) {
                NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
            }
}

DB Error: 26 "file is not a database.

I had added database at current place. My pod looks like

target 'FMDBDemo' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  pod 'FMDB/SQLCipher'   # FMDB with SQLCipher

  post_install do |installer|
      installer.pods_project.targets.each do |target|
          if target.name == "FMDB"
              config_path = target.build_configurations[0].base_configuration_reference.real_path
              File.open(config_path, "a") {|file| file.write("HEADER_SEARCH_PATHS = SQLCipher")}
          end
      end
  end

end
0

There are 0 answers