Saving audios and videos files paths in room database and auto update with new files saved in folders - mutablelivedata

I am developing an audio/video app in which I use Room database to save files paths so that recycler view adapter is populated quickly. This works but if I add new files to folders, those files are not updated in adapter. I am using Livedata but still not works. I have deployed MVVM model. Any solution?

Related

How to add metadata to files in iCloud Drive and read it offline?

I came across a variant of the same issue while developing very different iOS apps: I want to associate some custom metadata with files in the iCloud Drive and be able to read it while the files are offline.
So far I have tried two ways of doing this, but neither seemed to work: I tried adding extended attributes to the files, but it seems they are not stored offline like some other metadata.
I also tried storing the metadata in a CloudKit backed Core Data store. This way the metadata would always be available, I would just have to reference the file from the CoreData database somehow. However, I could not find an identifier that is unique to the file, identical over different devices, accessible while the file is not downloaded and independent of the location of the file (I want the user to be able to move files around freely).
Does anyone know how this problem could be solved? I basically just want to know a few custom things about offline iCloud files.

Core Data location file

Few years ago, I wrote an app using Core Data in Objective-C. The file.sqlite was saved on folder Documents. I would like to write an update version but in swift language and I am care about the users don't loose their saved records. I saw that the new file.sqlite is saved on folder Application Support. I have 2 questions:
is it possible to save on the same folder that the users don't loose the records?
Or is it possible to copy the old file.sqlite to Application Support that the users can update the old records?
You can put the persistent store file in any directory that your app can write to. Core Data has no rules about where these files have to go. If you want to use the documents folder, just use the documents folder.
If you're using NSPersistentContainer, you can change the default location by using an instance of NSPersistentStoreDescription. If you're not using NSPersistentContainer, use a file URL that points to your desired location when you call addPersistentStoreWithType:configuration:URL:options:error:.

How can I view the Tables structure in sqlite Manager add-on on Firefox?

I am creating a Database called Reminder.sqlite via Sqlite Manager add-on in firefox, after creating I am importing it to my iOS Application, the problem is that records are saved in database table but when I run a Select query in Sqlite manager no records are displayed any suggestions why this is happening?
make sure you have add database file into project and remove database file from document directory.
because old file is exist in document director, your new file with same name cannot be overwrite old one.(according to approach, if we use in code)
It may help you.

Updating an iOS app Deletes the content of Documents Folder

I have a folder structures inside the Documents Folder of iOS App. I am creating folder for each date and storing data related to the date inside the particular folder. Now i released the new version and i got a feed back from the user saying that when he updated the app his datas are lost. I am storing the png files inside the folders. Is there any way that when the user updates the app these document folder structure remains same ?

iPhone Core Data Migration leads to binary data loss when allow external storage selected

I am trying to add a new model. The new model will have one new entity and a relationship from a current entity to the new one. I have created the new model and set it as current. Although everything works fine and i can access the new entity, some 'binary data' entries are nil.
I tried adding a mapping model and then migrating, but the results are the same. The 'binary data' stored are UIImage. Some small thumbnails are being migrated. None of the full size UIImages are being migrated.
I am thinking that maybe the entities that are automatically stored externally (due to their size) are not being migrated.
UPDATE
I build a small project that stores image collections. I tried to create a new model and everything worked fine. Then i compare the new project with the old one and the only difference was the "Allows External Storage". I selected this option on the new project, created a new model and the pictures were missing.
I am thinking that maybe the entities that are automatically stored externally (due to their size) are not being migrated.
That's exactly what happens. It's an Apple bug. Binary data over a certain size gets stored by Core Data in an external support folder within the Documents folder. For some reason, during a migration, Core Data simply wipes that external storage folder - gulp! So thumbnail image data migrates ok as it's not stored externally to the SQLite DB but larger external binary files just get deleted.
The solution I’ve come up with is when your code initializes a persistent store coordinator for your Core Data model run a few checks before attempting automatic migration. Check whether the new model is compatible with the current stored model. If it’s not then you know that Core Data is about to migrate your old model to your new version and in doing so will wipe the external storage folder. Before it does so simply move the external storage folder to a temporary location. Once the migration has completed replace new empty external storage folder generated by Core Data.
I've documented the full solution with source code in this blog post:
http://www.nickkuh.com/iphone/core-data-migration-woes-with-binary-data-and-external-storage-data-loss/2012/06/

Resources