Skip to content

Commit

Permalink
Fixing another iOS app extension unsafe API usage in react native
Browse files Browse the repository at this point in the history
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [yes] Explain the **motivation** for making this change.
    Using react-native library inside iOS app extension causes a compile error inside react native stating that usage of UIAlertView is not allowed inside iOS app extension and should use UIAlertController instead. I have updated the code to use UIAlertController based on the other instances of the UIAlertController usage in the react-native library

- [ partial ] Provide a **test plan** demonstrating that the code is solid.
This code should be launched when developers start the profiler from the React native debug menu. I am currently in process of upgrading my app from 0.34 to the latest react native ( aka app not in working state). Would appreciate if there is an alternative way for me to test this functionality out.

Just tried to create a new react-native project using "react-native init testproject" and upon running "react-native run-ios", I  hit the following error a
Closes #13328

Differential Revision: D4844559

Pulled By: javache

fbshipit-source-id: e516ca57cb2abf2b09aa53abecb0fe60a40190b4
  • Loading branch information
shrutic authored and facebook-github-bot committed Apr 6, 2017
1 parent 6fa8713 commit 39eb090
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions React/Profiler/RCTProfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -772,11 +772,14 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data)
if (message.length) {
#if !TARGET_OS_TV
dispatch_async(dispatch_get_main_queue(), ^{
[[[UIAlertView alloc] initWithTitle:@"Profile"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"Profile"
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleCancel
handler:nil]];
[RCTPresentedViewController() presentViewController:alertController animated:YES completion:nil];
});
#endif
}
Expand Down

0 comments on commit 39eb090

Please sign in to comment.