Render UIView in the background.

Hi ,


I'm working with WatchOS and iOS connectivity. I send a request through the watch to render a UIView in the iPhone. In the iPhone I have to make a web request to get some parameters and render it later to convert it to an image NSData. This works while the iPhone app is in foreground. However, when the app goes to background it will never make the call. I'm handling this using something like this:


//Watch

[[WCSession defaultSession] sendMessage:@{@"GetNativeChart" : dataEntry.data.reportTitle,

@"Index" : numberIndex}

replyHandler:^(NSDictionary<NSString *,id> * _Nonnull replyMessage) {

} errorHandler:^(NSError * _Nonnull error) {

}];


//iPhone Appdelegate


-(void)session:(WCSession *)session didReceiveMessage:(NSDictionary<NSString *,id> *)message replyHandler:(void (^)(NSDictionary<NSString *,id> * _Nonnull))replyHandler {

if (message[@"GetNativeChart"]) {

[[OBIAskWatchManager sharedWatchManager] generateContentWithSearchInfo:message[@"GetNativeChart"] forSavedIndex:message[@"Index"] withCompletion:^(NSData *imageData) {

if (imageData) {

NSError *error;


//I use updateApplicationContext because the payload is almos 100kb

[[WCSession defaultSession] updateApplicationContext:@{@"chartInfo" : imageData

} error:&error];


}

}];

}

}


Do you have any idea if what I'm trying to do is possible?