Turning on replicators during push notification


#1

I’m trying to temporarily turn on replicators during a push notification. Inside

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

I have tried this:

  CBLManager *manager = [CBLManager sharedInstance];
  for (NSString* name in [manager allDatabaseNames]) {
    CBLDatabase* db = [manager databaseNamed:name error:nil];
    NSArray* replications = [db allReplications];
    for(CBLReplication* rep in replications) {
      rep.suspended = false;
    }
  }

But the list of replications returned by CBLDatabase allReplications is empty. I do have 2 replication process running. Any idea how can I get access to them?


#2

Just to be clear, you’re trying to turn replications on, so what do you mean when you say you have two running?


#3

He’s started two replications, but they’ve been paused/suspended because the app is in the background. However, when the app receives a push notification telling it about new data on the server, he wants to un-suspend the replicators. Unfortunately there isn’t a REST API for that.

We’ve been discussing this on the Google group in a parallel thread he started there.