React-native: RCTLinkingManager: Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

Created on 12 Sep 2018  Â·  21Comments  Â·  Source: facebook/react-native

Environment

React Native Environment Info:
System:
OS: macOS Sierra 10.12.6
Memory: 6.48 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.1 - ~/.nvm/versions/node/v8.11.1/bin/node
Yarn: 1.9.4 - ~/.yarn/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.2, macOS 10.13, tvOS 11.2, watchOS 4.2
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 9.2/9C40b - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.0 => 0.57.0

Description

After upgrading from React Native 0.55 to 0.57 and trying to compile the compile fails with
"Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)"
Screenshot: https://cl.ly/af7f38877e19

iOS Locked

Most helpful comment

Suggested fix

RCTLinkingManager.h

/**
 * 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:(nullable UIApplication *)app
            openURL:(nullable NSURL *)URL
            options:(nullable NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;

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

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

@end

All 21 comments

Suggested fix

RCTLinkingManager.h

/**
 * 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:(nullable UIApplication *)app
            openURL:(nullable NSURL *)URL
            options:(nullable NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options;

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

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

@end

@PublicParadise Wow, wonderful, works! Thank you for the super quick answer 🎉

react-native link solved it for me

For anyone looking for a workaround – if you're able to upgrade to xcode > 9.2 then that will also fix the problem (credit here).

A temporary workaround if you're not able to update Xcode - use patch-package https://www.npmjs.com/package/patch-package

I have same issue how solve this? react-native link don't work

I have same issue how solve this? react-native link don't work

Hi! Seems the latest release 0.57.1 fixes this issue.

This is solved, please ping me if you have any other problems with this.

This has cropped up again with XCode Version 10.2 (10E125).

I fixed it manually at first with _Nonnull assertions at first, nullable's work for me too.

+1

This issue seems to have popped up right after upgrading to XCode 10.2.

Have tried updating to react-native 57.1, cleaning build folders, react-native link and issue is still persisting.

I can confirm it, I ran into this after upgrading to 10.2 :(

nullable works for me too.

still an issue for me, with latest xcode 10.2 - react-native 0.59.3 @radko93

I am still facing the issue with react-native 0.57.0

Same issue when I upgrading to Xcode 10.2,
I'm using react-native 0.57.0 @radko93

seems we will be unnoticed here... I also met it after upgrading to xCode 10.2

@radko93 - wondering if we can reopen this for XCode 10.2, or if a new issue should be filed.

For the commenters above: the fix is to use the latest version of RN, which doesn't appear to have this issue. Otherwise, patch RCTLinking.

@ericlewis - Can you elaborate on what you mean with "patch RCTLinking"?

I've tried @PublicParadise's suggested change, which got rid of that problem, only to throw "React/RCTEventEmitter.h' file not found". Looking up that issue, gets me back to this one, so I feel like I'm going in circles trying to fix this on my own.

@PublicParadise thanks! works like charm )

Was this page helpful?
0 / 5 - 0 ratings