Please provide the following:
- SDK Version: 43.0.2
- Platforms(Android/iOS/web/all): Android and iOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
I am using expo-sqlite in an app that’s supposed to work on both iOS and Android, it works flawlessly on Android but on iOS I am getting the “file is not a database” error. Database file was generated using DB Browser for SQLite.
expo-env-info 1.0.3 environment info:
System:
OS: macOS 12.3.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.1.2 - /usr/local/bin/npm
Watchman: 2022.05.16.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
IDEs:
Xcode: 13.4/13F17a - /usr/bin/xcodebuild
npmPackages:
expo: ~43.0.2 => 43.0.3
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
npmGlobalPackages:
eas-cli: 0.52.0
expo-cli: 5.4.6
Expo Workflow: managed
const openDatabase = async (): Promise<SQLite.WebSQLDatabase> => {
if (
!(
await FileSystem.getInfoAsync(
FileSystem.documentDirectory + "SQLite/" + "database.db"
)
).exists
) {
await FileSystem.makeDirectoryAsync(
FileSystem.documentDirectory + "SQLite",
{ intermediates: true }
);
await FileSystem.downloadAsync(
Asset.fromModule(require("../database.db")).uri,
FileSystem.documentDirectory + "SQLite/database.db"
);
}
return SQLite.openDatabase("database.db");
};