Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Can I use SQLite as the database with Core Data? #50

Closed
sferoze opened this issue Jul 22, 2015 · 5 comments
Closed

Can I use SQLite as the database with Core Data? #50

sferoze opened this issue Jul 22, 2015 · 5 comments

Comments

@sferoze
Copy link

sferoze commented Jul 22, 2015

I am working with a developer who has never used Meteor before and he is creating the iOS app. He says he has a lot of experience with SQLite.

Does this package work with SQLite? Any consideration or things to change from the normal if using SQLite?

@martijnwalraven
Copy link
Owner

Meteor iOS uses an in memory cache to store documents received from the server. The easiest way to work with it is through the Core Data integration (which uses a custom NSIncrementalStore subclass, so not the default SQLite storage), but you could certainly access the cache through lower-level APIs yourself (see here). You'd have to handle all synchronization with a SQLite database yourself though.

Hope that answers your question.

@sferoze
Copy link
Author

sferoze commented Jul 24, 2015

@martijnwalraven Thank you it does! But One thing about using without core data doc that confuses me.

- (void)databaseDidChange:(NSNotification *)notification {
  dispatch_async(dispatch_get_main_queue(), ^{
    // If updating the UI, make sure this happens on the main thread
    METDatabaseChanges *databaseChanges = notification.userInfo[METDatabaseChangesKey];
    [databaseChanges enumerateDocumentChangeDetailsUsingBlock:^(METDocumentChangeDetails *documentChangeDetails, BOOL *stop) {
      ...
    }];
  });
}

Is this function supposed to automatically re-run anytime the database changes and new info is pushed to the iOS client?

Also can you please clarify what the databaseChanges enumerateDocumentChangeDetailsUsingBlock inside the database change function does?

Basically everything is working so far, but the only confusing part is when data changes in the database, how to detect those changes and sync the changes with SQLite

@sferoze
Copy link
Author

sferoze commented Jul 24, 2015

@martijnwalraven Because we added this function in the view controller and it doesn't seem to be called when we edit the info in the database using the web app

@martijnwalraven
Copy link
Owner

Have you used NSNotification​Center to subscribe to METDatabaseDidChangeNotification for the databaseDidChange method?

@sferoze
Copy link
Author

sferoze commented Jul 24, 2015

Ok that did it! Thank you so much!

@sferoze sferoze closed this as completed Jul 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants