Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration error when I try to test changes on devices #27

Open
3 tasks done
MiguelSernaMon opened this issue Jan 2, 2024 · 2 comments
Open
3 tasks done

Migration error when I try to test changes on devices #27

MiguelSernaMon opened this issue Jan 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MiguelSernaMon
Copy link

MiguelSernaMon commented Jan 2, 2024

Code of conduct

Self-training on how to write a bug report

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When I install Session I get a migration error even if I use the official IPA.
It seems like the StartupError function is always executing, even in the simulators of xcode I saw this problem a few times but the restore button works.
Here is the log: 2024/01/02 21:07:21:826 💛 [AppDelegate.swift:125 application(:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:07:21:836 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:21:837 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:21:840 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:21:841 💛
2024/01/02 21:07:21:843 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:07:21:845 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:07:24:160 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:162 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:164 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:165 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:167 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:168 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:169 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:172 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:186 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:191 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:24:192 💛 [Session, Main] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:07:24:195 💛 [Session, Main] Showing startup alert due to error: Failed to restore
2024/01/02 21:07:32:038 💛 [AppDelegate.swift:125 application(
:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:07:32:052 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:32:053 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:32:054 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:32:056 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:07:32:057 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:07:32:297 💛
2024/01/02 21:07:47:856 💛 [Version] iOS 15.4.1, App: 2.4.4 (428), libSession: v1.1.0-nogit
2024/01/02 21:07:50:316 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:07:51:926 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:928 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:930 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:931 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:938 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:939 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:940 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:942 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:943 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:975 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:07:51:976 💛 [Session, Main] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:07:51:979 💛 [Session, Main] Showing startup alert due to error: Failed to restore
2024/01/02 21:08:20:487 💛 [AppDelegate.swift:125 application(:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:08:20:503 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:08:20:504 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:08:20:506 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:08:20:507 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:08:20:508 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:08:20:748 💛
2024/01/02 21:09:43:001 💛 [AppDelegate.swift:125 application(
:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:09:43:019 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:43:020 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:43:022 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:43:023 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:09:43:025 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:09:43:245 💛
2024/01/02 21:09:56:070 💛 [AppDelegate.swift:125 application(:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:09:56:088 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:56:089 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:56:090 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:56:091 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:09:56:093 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:09:56:330 💛
2024/01/02 21:09:57:314 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:317 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:319 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:320 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:325 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:326 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:327 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:330 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:331 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:346 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:09:57:347 💛 [Session, Main] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:09:57:350 💛 [Session, Main] Showing startup alert due to error: Failed to restore
2024/01/02 21:10:02:848 💛 [AppDelegate.swift:125 application(
:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:10:02:866 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:02:867 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:02:868 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:02:869 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:10:02:871 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:10:03:094 💛
2024/01/02 21:10:04:250 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:253 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:254 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:256 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:261 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:262 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:263 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:265 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:266 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:275 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:04:276 💛 [Session, Main] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:10:04:279 💛 [Session, Main] Showing startup alert due to error: Failed to restore
2024/01/02 21:10:07:613 💛 [AppDelegate.swift:125 application(:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:10:07:632 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:07:633 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:07:635 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:10:07:636 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:10:07:637 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:10:07:870 💛
2024/01/02 21:13:39:322 💛
2024/01/02 21:13:40:302 💛 [Session, Main] Entered background before startup was completed
2024/01/02 21:13:40:311 💛
2024/01/02 21:13:40:315 💛
2024/01/02 21:15:44:113 💛 [AppDelegate.swift:125 application(
:didFinishLaunchingWithOptions:)]: application: didFinishLaunchingWithOptions completed.
2024/01/02 21:15:44:125 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:15:44:126 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:15:44:131 ❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.
2024/01/02 21:15:44:132 💛 [Session] [Database Error] Statup failed with error: SQLite error 14: unable to open database file
2024/01/02 21:15:44:133 💛 [Session, Main] Showing startup alert due to error: Database error
2024/01/02 21:15:44:317 💛
2024/01/02 21:15:45:261 💛
2024/01/02 21:15:46:142 💛 [Session, Main] Entered background before startup was completed
2024/01/02 21:15:46:145 💛
2024/01/02 22:25:03:239 💛 [ScreenLockUI.swift:363 clockDidChange()]: clock did change
2024/01/02 22:25:03:242 💛
2024/01/02 22:25:03:560 💛
2024/01/02 22:25:04:757 💛 [Version] iOS 15.4.1, App: 2.4.4 (428), libSession: v1.1.0-nogit

Expected Behavior

The app should open without problem

Steps To Reproduce

  1. Download the official IPA from GitHub
  2. install it on your iPhone using sideloadly
  3. open the app

iOS Version

iOS 15.4

Session Version

2.4.4

Anything else?

image

@MiguelSernaMon MiguelSernaMon added the bug Something isn't working label Jan 2, 2024
@mpretty-cyro
Copy link
Collaborator

So in these logs it looks like for some reason the app can't access the "shared data directory"

❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.

The "shared data directory" is an "AppGroup" directory (basically a directory which can be accessed by the app, share & notification extensions), these directories need to be registered with Apple and built into the app when compiling (In the source it can be found in the Session target -> Signing & Capabilities -> App Groups, as well as in SNUserDefaults.swift L:65) currently it's hard-coded to group.com.loki-project.loki-messenger

@MiguelSernaMon I've not used Sideloadly before, do you know if it supports App Groups?

If it does then we'd also need to make a change to the code to detect that it's been side-loaded and request the custom AppGroup identifier on the first launch so that we can load the database from the correct location 🤔

@MiguelSernaMon
Copy link
Author

MiguelSernaMon commented Jan 9, 2024

So in these logs it looks like for some reason the app can't access the "shared data directory"

❤️ [MainAppContext.swift:238 appSharedDataDirectoryPath()]: Assertion failed.

The "shared data directory" is an "AppGroup" directory (basically a directory which can be accessed by the app, share & notification extensions), these directories need to be registered with Apple and built into the app when compiling (In the source it can be found in the Session target -> Signing & Capabilities -> App Groups, as well as in SNUserDefaults.swift L:65) currently it's hard-coded to group.com.loki-project.loki-messenger

@MiguelSernaMon I've not used Sideloadly before, do you know if it supports App Groups?

If it does then we'd also need to make a change to the code to detect that it's been side-loaded and request the custom AppGroup identifier on the first launch so that we can load the database from the correct location 🤔

I've been trying several sideload apps like Scarlet, altstore, and Impactor. None of them work.
The only one that works for me was Trollstore (it uses exploits to install and sign apps forever) but I don't know why session works with this method.

In general, I think that the problem may be that when Session is sideloaded the shared data directory can't be accessed correctly with the actual code

@KeeJef KeeJef transferred this issue from oxen-io/session-ios Nov 4, 2024
@stfsession stfsession transferred this issue from another repository Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants