readium / swift-toolkit

A toolkit for ebooks, audiobooks and comics written in Swift
https://readium.org/mobile/
BSD 3-Clause "New" or "Revised" License
222 stars 96 forks source link

Error"Error initializing db." #405

Closed 22222912 closed 1 month ago

22222912 commented 3 months ago

Describe the bug

new class A extend DRMLibraryService, initializing cause crushing by error"Error initializing db."

How to reproduce?

1 spm like this 企业微信截图_857fdb8a-f10b-4916-8baa-f6ed1e2d8e61 2 new class LCPLibraryService extend DRMLibraryService 企业微信截图_20aeae17-5864-4f22-b8f6-c67f85559b04 3 LCPLibraryService *lcpService = [[LCPLibraryService alloc] init];

Readium version

2.6.1

OS version

IPADOS 17.3.1

Testing device

iPad 10

Environment

MACOS 14
Platform arm64
Carthage: 0.39.1
XCODE 15.3

Additional context

企业微信截图_20aeae17-5864-4f22-b8f6-c67f85559b04 企业微信截图_d7334869-b429-4c1c-ad38-ca7567729465 企业微信截图_40f74026-40ce-48ef-b7d7-d7b27ff81a68

mickael-menu commented 3 months ago

I'm not sure what's causing this. Maybe a permissions issue on the folder? Can you run fine on a real device?

I would open an issue on https://github.com/stephencelis/SQLite.swift, as the error is triggered by this third-party dependency.

22222912 commented 3 months ago

The above error is I have runned it on iPad

22222912 commented 3 months ago

in addition I run test app. by Carthage making , replace my own bundle id of "org.readium.TestApp", I find that it run crush on device when launching with。another error. "unable to open database file" 企业微信截图_17f92f3c-4157-4aff-802d-c631156c2fbb

企业微信截图_b784b5a6-0ce4-4a59-8598-327fd3392173

and find some answer https://stackoverflow.com/questions/77206338/xcode-15-ios-17-objc3422-class-ttc6sqlite-is-implemented-in-both-one-o

mickael-menu commented 3 months ago

This looks like the same error but in a different context : in the Test App SQLite database with the GRDB dependency instead of SQLite.swift.

I do have the same warnings about _TtC6SQLite* symbols, I don't know if this is the culprit for the crash you observe, but it is definitely concerning with the StackOverflow link you shared.

There's another relevant SQLite.swift issue reported there: https://github.com/stephencelis/SQLite.swift/issues/1177

I think this will increase the priority of a task that was postponed: removing the SQLite database from the ReadiumLCP package, for the v3.

Unfortunately I don't have any solution to offer right now.

mickael-menu commented 3 months ago

Just for debugging purposes, do you still have the same crash if you don't enable LCP in the Test App and your app? ReadiumLCP is the only package that depend on SQLite.swift.

22222912 commented 3 months ago

I find that test app run successfully in simulator but crush in device, here is the key point

there. is no database.dbfile file to init with Appmodel class , 企业微信截图_7d63adae-a186-4da7-9abe-da65b597494d

企业微信截图_6d729a2e-8d82-4daa-bab3-d77c1ebc7b04

22222912 commented 3 months ago

I intergate LCP to my own app,app run successfully,but when I use some lcp class,it crush!

when I new a class extend DRMLibraryService,run in device. and new that class it also crush without daabase.db file

企业微信截图_ec4962d2-5675-46ca-ae20-9603e970d08d

mickael-menu commented 3 months ago

If you remove LCP in the Test App (generate with make dev for example, without using the lcp= parameter), are you able to run the app without crash on your device?

I want to know if the problem is triggered by embedding SQLite.swift in the toolkit.

22222912 commented 3 months ago

I make by Carthage here is my operation Run only”make carthage” instead of “make carthage lcp=https://lixxx/ios/XX/liblcp.json
found that test app without LCPClient also crush in device

mickael-menu commented 3 months ago

Hmm okay, then I'm not sure it's related to the StackOverflow you shared earlier. Besides something weird with your device, I don't have a better idea.

22222912 commented 3 months ago

I have intergated to my app run successfully and open lcpl format file to read in simulator but faile d in device with the above problem

22222912 commented 2 months ago

No

From:Mickaël Menu @.> Sent At:2024 Mar. 28 (Thu.) 19:12 To:readium/swift-toolkit @.> Cc:Travis Xu @.>; Author @.> Subject:Re: [readium/swift-toolkit] Error"Error initializing db." (Issue #405) If you remove LCP in the Test App (generate with make dev for example, without using the lcp= parameter), are you able to run the app without crash on your device? I want to know if the problem is triggered by embedding SQLite.swift in the toolkit. — Reply to this email directly, view it on GitHub <https://github.com/readium/swift-toolkit/issues/405#issuecomment-2024933899 >, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADD2ICEQYR3BK6IU377IMB3Y2PUHNAVCNFSM6AAAAABFIPD63SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRUHEZTGOBZHE >. You are receiving this because you authored the thread.Message ID: @.***>

mickael-menu commented 1 month ago

I removed the SQLite.swift dependency from the ReadiumLCP package in https://github.com/readium/swift-toolkit/pull/442. Hopefully this will allow apps to circumvent any issues integrating SQLite.swift by implementing a different repository.