[ReactNative] Fix alert out of main thread

Summary:
@public

I've added an alert to notify when the profile has been generated, but it was
being created out of the main thread.

Test Plan:
Launch the UIExplorer, start and stop profiling, an alert should show up, and
everything should just keep working as expected.
This commit is contained in:
Tadeu Zagallo 2015-06-23 08:17:29 -01:00
parent 0c38229e8e
commit bd3f9763f7
1 changed files with 7 additions and 5 deletions

View File

@ -1530,11 +1530,13 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
if (error) {
RCTLogError(@"%@", error.localizedDescription);
} else {
[[[UIAlertView alloc] initWithTitle:@"Profile"
message:@"The profile has been generated, check the dev server log for instructions."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
dispatch_async(dispatch_get_main_queue(), ^{
[[[UIAlertView alloc] initWithTitle:@"Profile"
message:@"The profile has been generated, check the dev server log for instructions."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
});
}
}];