diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index c5d6effa1..28bee82ce 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -385,7 +385,7 @@ namespace llmr { } - void request_http(std::string url, std::function func, std::function cb) + void request_http(std::string url, std::function background_function, std::function foreground_callback) { [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@1 forKey:@"count"]]; @@ -407,10 +407,11 @@ namespace llmr res.body = { (const char *)[data bytes], [data length] }; } - func(res); + background_function(res); - dispatch_async(dispatch_get_main_queue(), ^(void) { - cb(); + dispatch_async(dispatch_get_main_queue(), ^(void) + { + foreground_callback(); }); [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil userInfo:[NSDictionary dictionaryWithObject:@(-1) forKey:@"count"]];