Partial Sync results.subscribe()


Using Realm Cloud + RealmSwift 3.5

Does the method subscribe() still exist? It’s not found
let results = realm.objects(Person.self).filter(“age > 18”)
let subscription = results.subscribe()

Also, I can’t get my head round partial sync, I created a partially synced realm - added objects to it. Then logged in using a separate user - same path (partial sync) this user cannot see the objects. I made both users admin so it shouldn’t be a permission issue? Do I have to do anything to sync the added data


Theoretically you just define a query and add a NotificationToken to it and it’ll eventually pop up.


Doesn’t work…
Using partial sync, I guess would mean all data in the relevant path is accessible to all users given they have permissions, right?


Define “doesn’t work”

Show code for how SyncConfiguration (with partial sync flag) is created, how Realm is opened, and how Results is observed, and what the query is, and the model for which that doesn’t work.

Also, if the email address used to log in has an invalid format, I had things “not sync” in ROS 1.x, dunno if they retained that particular behavior.


I’m testing using the basic requirements

  • Both users are Admin, and I have successfully logged in (using username not email address)
  • My model has no ACL set

I’ve tried the below (I relaunch and get results again at every login), as well as observing the results

class Item: Object {
    let itemId = RealmOptional<Int>()
    @objc dynamic var name: String? = nil

let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL, isPartial: true))

let realm = try Realm(configuration: config)

let predicate = NSPredicate(format: "itemId == %i", 1)
let results = realm.objects(Item.self).filter(predicate)

The creator of the Item can see the item in results, but no other use can


If anyone else bumps into a similar problem
The subscribe() method was not showing because I was using an older version of xcode (8.3) :unamused: