Set up the iOS application to perform a background synchronization.
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
UIBackgroundFetchResult result = UIBackgroundFetchResultNoData;
NSLog(@"background fetch called");
SUPApplication* app = [SUPApplication getInstance];
if (!SUPApplication.applicationIdentifier)
{
app.applicationIdentifier = @"supsample";
}
if(!self.firstRun)
{
SUPConnectionProfile *cp = [SUPSampleSUPSampleDB getConnectionProfile];
[cp setEncryptionKey:@"e77d4007dd40d75037e3bdba005f38dc1002e41043e7ad7c17cd34eb5eb8d7bf75e01df5001db8085179f05e040c307c"];
[SUPSampleSUPSampleDB closeConnection];
SUPConnectionProfile *sp = [SUPSampleSUPSampleDB getSynchronizationProfile];
[sp setAsyncReplay:NO];
[sp setUser:self.userName];
[sp setPassword:@"s3pAdmin"];
[sp setServerName:self.serverName];
[sp setPortNumber:[self.serverPort intValue]];
[sp setNetworkProtocol:@"http"];
[sp setNetworkStreamParams:@"url_suffix=/ias_relay_server/client/rs_client.dll/douglowder.dddRBS"];
[sp setDomainName:@"default"];
@try
{
[SUPSampleSUPSampleDB synchronizeWithListener:[CallbackHandler getInstance]];
result = UIBackgroundFetchResultNewData;
NSLog(@"Background fetch succeeded");
}
@catch (NSException *exception)
{
result = UIBackgroundFetchResultFailed;
NSLog(@"Background fetch failed: %@",[exception description]);
NSLog(@"%@",[exception callStackSymbols]);
}
}
completionHandler(result);
}