2

Just curious if anybody else is getting this since the XCode Version 10.2 (10E125) update and know the fix?

  • macOS Mojave 10.14.3 (18D109)
  • "react-native": "0.57.0"
  • Node v11.6.0
  • npm: 6.5.0-next.0
  • Yarn: 1.14.0-20181221.0548
Leo
  • 10,407
  • 3
  • 45
  • 62

3 Answers3

5

It boiled down to RCTLinkingManager.h in the end.

I amended it with non-null assertions like so:

/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import <UIKit/UIKit.h>

#import <React/RCTEventEmitter.h>

@interface RCTLinkingManager : RCTEventEmitter

+ (BOOL)application:(UIApplication *_Nonnull)app
            openURL:(NSURL *_Nonnull)URL
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *_Nonnull)options;

+ (BOOL)application:(UIApplication *_Nonnull)application
            openURL:(NSURL *_Nonnull)URL
  sourceApplication:(NSString *_Nonnull)sourceApplication
         annotation:(id _Nonnull )annotation;

+ (BOOL)application:(UIApplication *_Nonnull)application
continueUserActivity:(NSUserActivity *_Nonnull)userActivity
 restorationHandler:(void (^_Nonnull)(NSArray * __nullable))restorationHandler;

@end

And now getting a successful build.

Leo
  • 10,407
  • 3
  • 45
  • 62
2

If you're using cocoapods (and don't check your Pods in), you can add this to the bottom of your podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        case target.name
            when /\AReact/
            target.build_configurations.each do |config|
                # Xcode 10.2 requires suppression of nullability for React
                # https://stackoverflow.com/questions/37691049/xcode-compile-flag-to-suppress-nullability-warnings-not-working
                config.build_settings['WARNING_CFLAGS'] ||= ['"-Wno-nullability-completeness"']
            end
        end
    end
end

This will flip off the nullability completeness check for React Native.

Chase Holland
  • 2,178
  • 19
  • 23
0

To get rid of the warnings I modified the two header files (RCTEventEmitter.h and RCTJSInvokerModule.h) using patch-package adding NS_ASSUME_NONNULL*.

#import <React/RCTBridge.h>
#import <React/RCTJSInvokerModule.h>

NS_ASSUME_NONNULL_BEGIN

@interface RCTEventEmitter : NSObject <RCTBridgeModule, RCTJSInvokerModule>

// ...

@end

NS_ASSUME_NONNULL_END
Simon Bengtsson
  • 7,573
  • 3
  • 58
  • 87