Suppress warning when checking for `JSGlobalContextSetName`

Summary: This API is defined only on iOS 8 and newer. There is a warning that the function is defined when checking if it exists since it is always defined in the iOS 8 SDK but not necessarily on iOS 7 phones. Use pragmas to silence the warning.
Closes https://github.com/facebook/react-native/pull/2475

Reviewed By: @​trunkagent, @vjeux

Differential Revision: D2443432

Pulled By: @tadeuzagallo
This commit is contained in:
James Ide 2015-09-24 02:47:43 -07:00 committed by facebook-github-bot-9
parent 33cc607c1f
commit 944fa4d635
1 changed files with 3 additions and 0 deletions

View File

@ -587,7 +587,10 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
RCT_EXPORT_METHOD(setContextName:(nonnull NSString *)name)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
if (JSGlobalContextSetName != NULL) {
#pragma clang diagnostic pop
JSStringRef JSName = JSStringCreateWithCFString((__bridge CFStringRef)name);
JSGlobalContextSetName(_context.ctx, JSName);
JSStringRelease(JSName);