Fixing another iOS app extension unsafe API usage in react native

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 https://github.com/facebook/react-native/pull/13328

Differential Revision: D4844559

Pulled By: javache

fbshipit-source-id: e516ca57cb2abf2b09aa53abecb0fe60a40190b4
This commit is contained in:
Shruti Malugu 2017-04-06 12:28:41 -07:00 committed by Facebook Github Bot
parent 6fa87134fc
commit 39eb090906
1 changed files with 8 additions and 5 deletions

View File

@ -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
}