Fix crashing Systrace when debugging JS remotely
Reviewed By: fromcelticpark Differential Revision: D6522026 fbshipit-source-id: 11920ecc0133f47314607a0b3431f27027cc9e22
This commit is contained in:
parent
f871d25eb4
commit
e8eec24706
|
@ -217,6 +217,11 @@ RCT_EXPORT_MODULE()
|
||||||
alertControllerWithTitle:@"Remote JS Debugger Unavailable"
|
alertControllerWithTitle:@"Remote JS Debugger Unavailable"
|
||||||
message:@"You need to include the RCTWebSocket library to enable remote JS debugging"
|
message:@"You need to include the RCTWebSocket library to enable remote JS debugging"
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
__weak typeof(alertController) weakAlertController = alertController;
|
||||||
|
[alertController addAction:
|
||||||
|
[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
||||||
|
[weakAlertController dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}]];
|
||||||
[RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL];
|
[RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL];
|
||||||
}]];
|
}]];
|
||||||
} else {
|
} else {
|
||||||
|
@ -241,7 +246,20 @@ RCT_EXPORT_MODULE()
|
||||||
[items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{
|
[items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{
|
||||||
return devSettings.isProfilingEnabled ? @"Stop Systrace" : @"Start Systrace";
|
return devSettings.isProfilingEnabled ? @"Stop Systrace" : @"Start Systrace";
|
||||||
} handler:^{
|
} handler:^{
|
||||||
devSettings.isProfilingEnabled = !devSettings.isProfilingEnabled;
|
if (devSettings.isDebuggingRemotely) {
|
||||||
|
UIAlertController *alertController = [UIAlertController
|
||||||
|
alertControllerWithTitle:@"Systrace Unavailable"
|
||||||
|
message:@"You need to stop remote JS debugging to enable Systrace"
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
__weak typeof(alertController) weakAlertController = alertController;
|
||||||
|
[alertController addAction:
|
||||||
|
[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
||||||
|
[weakAlertController dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}]];
|
||||||
|
[RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL];
|
||||||
|
} else {
|
||||||
|
devSettings.isProfilingEnabled = !devSettings.isProfilingEnabled;
|
||||||
|
}
|
||||||
}]];
|
}]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue