NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

CLI 8.8.0 - SQLCipher does not seem to be linked into the application #5809

Closed cjohn001 closed 1 month ago

cjohn001 commented 3 months ago

Issue Description

Hello together, I have tried upgrading my NS Angular app to nativescript version 8.8.0. I am able to build and run the app with the nativscript 8.7.2 CLI and the new core 8.8 as well as ios runtime packages. However, when upgrading the CLI to 8.8 I get the following error at runtime. Hence, definitely a problem with the CLI. Seems like the SQLCipher is not linked into the app.

NativeScript loaded library /Library/Developer/CoreSimulator/Volumes/iOS_21F79/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.5.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libsqlite3.dylib SQLCipher does not seem to be linked into the application

I have no idea how to resolve this issue. Would be great if someone could provide some directions.

Please note, in the environment attached below you see 8.7.2 as I have already downgraded the CLI to get things back running. The relevant CLI version I installed was 8.8.0

Best regards, Christoph

Reproduction

No response

Relevant log output (if applicable)

No response

Environment

OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Shell: /bin/zsh
node: 20.11.1
npm: 10.2.4
nativescript: 8.7.2

# android
java: 11.0.22
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: 15.4/15F31d
cocoapods: 1.15.2
python: 3.12.3
python3: 3.12.3
ruby: 2.7.8
platforms: 
  - DriverKit 23.5
  - iOS 17.5
  - macOS 14.5
  - tvOS 17.5
  - visionOS 1.2
  - watchOS 10.5

Dependencies

"dependencies": {
  "@angular/animations": "18.1.3",
  "@angular/common": "18.1.3",
  "@angular/compiler": "18.1.3",
  "@angular/core": "18.1.3",
  "@angular/forms": "18.1.3",
  "@angular/platform-browser": "18.1.3",
  "@angular/platform-browser-dynamic": "18.1.3",
  "@angular/router": "18.1.1",
  "@apollo/client": "3.11.2",
  "@mnd/external-web-view": "file:../app-plugins/dist/packages/external-web-view/mnd-external-web-view-1.0.1.tgz",
  "@nativescript/angular": "18.1.1",
  "@nativescript/core": "8.8.2",
  "@nativescript/iqkeyboardmanager": "2.1.1",
  "@nativescript/localize": "5.2.0",
  "@nativescript/mlkit-barcode-scanning": "2.1.0",
  "@nativescript/mlkit-core": "2.1.0",
  "@nativescript/secure-storage": "3.0.3",
  "@nativescript/theme": "3.1.0",
  "@nativescript/ui-charts": "0.2.4",
  "apollo-angular": "7.0.2",
  "apollo3-cache-persist": "0.15.0",
  "d3-ease": "3.0.1",
  "graphql": "16.9.0",
  "graphql-tag": "2.12.6",
  "intl": "1.2.5",
  "moment": "2.30.1",
  "nativescript-health-data": "file:../app-plugins-customized/nativescript-health-data/publish/package/nativescript-health-data-2.0.0.tgz",
  "nativescript-oauth2-ext": "file:../app-plugins-customized/nativescript-oauth2-ext/publish/package/nativescript-oauth2-ext-3.0.3.tgz",
  "nativescript-sqlite": "2.8.6",
  "nativescript-sqlite-commercial": "file:../app-plugins-customized/commercial-sqlite/nativescript-sqlite-commercial-1.8.0.tgz",
  "nativescript-sqlite-encrypted": "file:../app-plugins-customized/commercial-sqlite/nativescript-sqlite-encrypted-1.6.0.tgz",
  "nativescript-ui-calendar": "15.2.3",
  "nativescript-ui-gauge": "15.2.3",
  "qs": "npm:querystring@0.2.1",
  "rxjs": "7.8.1",
  "util": "0.12.5",
  "uuidjs": "5.1.0",
  "zone.js": "0.14.8"
},
"devDependencies": {
  "@angular-devkit/build-angular": "18.1.3",
  "@angular/compiler-cli": "18.1.3",
  "@graphql-codegen/cli": "5.0.2",
  "@graphql-codegen/fragment-matcher": "5.0.2",
  "@graphql-codegen/introspection": "4.0.3",
  "@graphql-codegen/typescript": "4.0.9",
  "@graphql-codegen/typescript-apollo-angular": "4.0.0",
  "@graphql-codegen/typescript-operations": "4.2.3",
  "@nativescript/android": "8.8.2",
  "@nativescript/ios": "8.8.1",
  "@nativescript/types": "8.8.0",
  "@nativescript/webpack": "5.0.22",
  "@ngtools/webpack": "18.1.3",
  "@types/d3-ease": "3.0.2",
  "@types/intl": "1.2.2",
  "@types/lodash": "4.17.7",
  "@types/node": "22.0.2",
  "keycloak-request-token": "0.1.0",
  "rimraf": "6.0.1",
  "sass": "1.77.8",
  "ts-node": "10.9.2",
  "typescript": "5.4.5"
}

Please accept these terms

eric-sandstrom commented 2 months ago

I'm also blocked from updating the CLI to 8.8.x because the same exact issue.

cjohn001 commented 2 months ago

@eric-sandstrom: If you are also using the commercial version of the SQLite database (encrytion module), one note here. I am currently in touch with Nathan A. He is currently investigating the issue. According to first feedback, it seems like the cli is broken rather than the plugin.

eric-sandstrom commented 2 months ago

@cjohn001 Yes I do use all these paid modules. I actually emailed him 30min ago so good that you are in touch already! :)

cjohn001 commented 1 month ago

Hello together, attached you find a workaround for the nativescript-sqlite-encrypted plugin. As the plugin is closed source I can unfortunately only provide you with an explanation on how to fix it. Please note, according to the SQLCipher homepage the latest version of SQLCipher should be compatible with the commercial plugin, however, bear in mind that my version uses SQLCipher 3.46.1 in case you run into issues. An explanation to build a different version from source is provided in the zip archive as well.

How to fix: Get a copy from nativescript-sqlite-encrypted from node_modules and copy the folder to your application directory. Than replace SQLCipher.framework in platforms/ios with the SQLCipher.xcframework from here. The archive also includes the sources, so you do not need to trust my binary :) Optionally, you can also add the types. However, they are not required to get encryption back running.

Finally you need to switch to the modified plugin in package.json

"nativescript-sqlite-encrypted": "file:nativescript-sqlite-encrypted"

Bildschirmfoto 2024-10-01 um 17 52 08

Hope this helps till the package maintainer releases an update. I believe this is not an issue of Nativescript, but with the way the framework file in the plugin was built. I assume it breaks because of the switch to swift and xcframeworks. There was an error report on the sqlcipher homepage which brought me to the idea to rebuild it, see section about "Preprocessor Macros" when using swift https://www.zetetic.net/sqlcipher/ios-tutorial/