Can read only realms still only be opened using asyncOpen?


Can read only realms still only be opened using asyncOpenWithConfiguration as described here or has partials sync fixed this problem so that we can sync realms down without syncing anything back up?


@nsnick Correct - partial sync fixes this


The documentation for Realm Objective-C 3.5.0 still has the asyncOpen caveat for read only realms. I am still seeing a permission denied error when syncing a read only realm without asyncOpen. Is there something I should be doing to tell realm to use partial sync and not try to sync the whole realm other than setting isPartial in the syncConfiguration?


@nsnick You should be setting isPartail sync to true yes. Is this a new realm? Can you check if the realm is listed as a full or reference realm in the RealmFile object of the /__admin realm please?


This is on realm cloud. I only see /default and two user realms in realm studio; there is no /__admin realm. It is a new realm.

Also, RLMRealm.h says that subscribeToObjects:where:callback: is deprecated and that one should use -[RLMResults subscribe] but RLMResults.h doesn’t have any subscribe methods and the partial sync documentation here doesn’t say that [RLMRealm subscribe] is deprecated. What is the current way to partially sync objects using objective-c?


@nsnick You can do Show > show System Realms - and the /__admin Realm should appear.

So you are trying to synchronously open the default realm? How did you assign permissions? You can see the APIs here:

You will notice there is now a ModifySchema permission. Which is how we deal with opening a Realm that is read-only.

Subscribe is described here for Obj-C:

The code you are looking for is here:

We are a bit behind on updating our docs.


The realm was listed as a full realm. I believe that is because I was having the user that created it treat it as a fully synced realm and all other users who are supposed to only have read only access to it treat it as a partially synced realm. I take it you can’t do that?

I am trying to sync one of the user created realms not the default realm.

For the subscribe method, is there a wildcard that will subscribe to all objects of a particular class?

Does a user need the ModifySchema permission in order to sync down a read only realm?

The API examples for setting object level permissions don’t work or are incomplete in Objective-C because there is no getUser() function in the Objective-C version of realm-cocoa. I am currently still using the old permission setting methods using RLMSyncPermission. Do I need to also use the new RLMPermissionRole or are object, class, and realm level permissions automatically set to allow all users if you don’t set any permissions?

When I try using the partial sync permission method below I get the error:
*** Terminating app due to uncaught exception ‘RLMException’, reason: ‘Object type ‘RLMPermissionRole’ is not managed by the Realm. If using a custom objectClasses / objectTypes array in your configuration, add RLMPermissionRole to the list of objectClasses / objectTypes.’

	RLMRealmConfiguration *realmConfig = [[RLMRealmConfiguration alloc] init];
    realmConfig.fileURL = [NSURL URLWithString:path];
    realmConfig.objectClasses = @[[Dog self], [Cat self]];
    RLMSyncConfiguration *syncConfig = [[RLMSyncConfiguration alloc] initWithUser:[RLMSyncUser currentUser] realmURL:remoteRealmURL];
    syncConfig.isPartial = TRUE;
    realmConfig.syncConfiguration = syncConfig;
    NSError *error = nil;
    RLMRealm *newRealm = [RLMRealm realmWithConfiguration:realmConfig error:&error];
    if (error != nil) {
	    callback(FALSE, error);

    [newRealm transactionWithBlock:^{
	    // Create the role
	    RLMPermissionRole *readWriteRole = [RLMPermissionRole createInRealm:newRealm withValue:@[@"read-write"]];

	    // Add the user to the role
	    RLMSyncUser *currentUser = [RLMSyncUser currentUser];
	    RLMPermissionUser *user = [RLMPermissionUser userInRealm:newRealm withIdentity:currentUser.identity];
	    [readOnlyRole.users addObject:user];

	    // Create a new permission object for the role and add it to the Realm permissions
	    RLMPermission *permission = [RLMPermission onRealm:newRealm];
	    permission.canRead = YES;
	    permission.canQuery = YES;
	    permission.canCreate = YES;
	    permission.canDelete = YES;
	    permission.canUpdate = YES;
	    permission.canModifySchema = YES;
	    permission.canSetPermissions = YES;


@nsnick Can you please change the Realm from full to reference and then apply the Read permissions and then try to open the Realm? You can use Studio to rename the string for now


Yeah. I fixed the full to partial before encountering the problems in the above post. The problems in the above post are present when the realm is set to partial.


The error message indicates that you need to include RLMPermissionRole where you define:
realmConfig.objectClasses =