let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("TurMer.sqlite”)
Once this line is executed, it tells me that everything is correct.
Not quite correct. That line returns a URL for where that file would be located (within your Documents directory) whether it exists or not. It doesn’t check if that a file actually exists at that location. In this case, no such file exists. When your app first starts, the Documents directory is empty.
See @eskimo’s reply above for finding your database file within your app bundle, which is totally separate from the Documents directory.
if sqlite3_open(fileURL.path, &BaseDatos) != SQLITE_OK
In this line we have opened the database. Everything is correct, it tells me that the database exists
Not quite. Note the documentation for sqlite3_open says that the database will be created if it doesn’t already exist. So this actually creates and opens an empty database. That’s why the subsequent query fails.
In general, don’t use sqlite3_open in new code. You should switch to sqlite3_open_v2 which gives you better control over its behavior. Use the flag SQLITE_OPEN_READONLY (since you said earlier that your database is read-only) or use SQLITE_OPEN_READWRITE if desired. This will cause sqlite3_open_v2 to fail if the file doesn’t already exist, which would have alerted you to the problem earlier.