Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 15 RN 0.59 error: UIViewController is missing its initial trait collection populated during initialization #7878

Open
1 task done
igorSysmap opened this issue May 16, 2024 · 1 comment

Comments

@igorSysmap
Copy link

What happened?

I'm maintaining a legacy app built with React Native. I can build it, and the app opens without issues on both iOS 16 and iOS 17 devices. The problem occurs when I try to log in. On the iOS 16 device, when I click the login button, I'm directed to the home screen, which is the expected behavior. On the iOS 17 device, the following error occurs. I've been researching for days and can't find anything to help me deal with this problem. I know it's a complicated situation because it's a very old version of React Native, but currently, updating is not an option. I appreciate anyone who can help.

Erro

image

Exception 'UIViewController is missing its initial trait collection populated during initialization. This is a serious bug, likely caused by accessing properties or methods on the view controller before calling a UIViewController initializer. View controller: <RNNSideMenuController: 0x7f8b5e30a200>' was thrown while invoking setRoot on target RNNBridgeModule with params (
    setRoot7,
        {
        modals =         (
        );
        overlays =         (
        );
        root =         {
            children =             (
                                {
                    children =                     (
                                                {
                            children =                             (
                            );
                            data =                             {
                                name = "ssgapp.Menu";
                                options =                                 {
                                };
                            };
                            id = Drawer;
                            type = Component;
                        }
                    );
                    data =                     {
                    };
                    id = SideMenuLeft5;
                    type = SideMenuLeft;
                },
                                {
                    children =                     (
                                                {
                            children =                             (
                                                                {
                                    children =                                     (
                                    );
                                    data =                                     {
                                        name = "ssgapp.Dashboard";
                                        options =                                         {
                                            topBar =                                             {
                                                background =                                                 {
                                                    color = 0;
                                                };
                                                drawBehind = 1;
                                                elevation = 0;
                                                leftButtons =                                                 (
                                                                                                        {
                                                        color = 4294967295;
                                                        icon =                                                         {
                                                            scale = 3;
                                                            uri = "/Users/sysmap/Library/Developer/CoreSimulator/Devices/164CD310-F4A4-42B0-BE4F-310F5C8AEF7B/data/Containers/Data/Application/EA54EBF0-86E2-4B2B-97E3-98ECEA57A62D/tmp/RNVectorIcons__Ionicons_61891_30#000000@3x.png";
                                                        };
                                                        id = menuToggleButton;
                                                    }
                                                );
                                                rightButtons =                                                 (
                                                                                                        {
                                                        color = 553648127;
                                                        enabled = 0;
                                                        icon =                                                         {
                                                            scale = 3;
                                                            uri = "/Users/sysmap/Library/Developer/CoreSimulator/Devices/164CD310-F4A4-42B0-BE4F-310F5C8AEF7B/data/Containers/Data/Application/EA54EBF0-86E2-4B2B-97E3-98ECEA57A62D/tmp/RNVectorIcons__Ionicons_61826_30#000000@3x.png";
                                                        };
                                                        id = filterToggleButton;
                                                    }
                                                );
                                                title =                                                 {
                                                    color = 4294967295;
                                                    component =                                                     {
                                                        alignment = center;
                                                        componentId = CustomComponent8;
                                                    };
                                                    fontFamily = DINPro;
                                                    text = "Pend\\U00eancias";
                                                };
                                            };
                                        };
                                    };
                                    id = App;
                                    type = Component;
                                }
                            );
                            data =                             {
                            };
                            id = AppRoot;
                            type = Stack;
                        }
                    );
                    data =                     {
                    };
                    id = SideMenuCenter6;
                    type = SideMenuCenter;
                }
            );
            data =             {
                options =                 {
                    layout =                     {
                        orientation =                         (
                            portrait
                        );
                    };
                    topBar =                     {
                        background =                         {
                            color = 0;
                        };
                        drawBehind = 1;
                        elevation = 0;
                    };
                };
            };
            id = sideMenu;
            type = SideMenuRoot;
        };
    },
    560,
    561
)
callstack: (
	0   CoreFoundation                      0x000000010b6c4571 __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000010aaff7e8 objc_exception_throw + 48
	2   Foundation                          0x00000001103b878b -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
	3   UIKitCore                           0x0000000122c70299 UIViewControllerMissingInitialTraitCollection + 215
	4   UIKitCore                           0x0000000122c75006 -[UIViewController traitCollection] + 168
	5   UIKitCore                           0x0000000122c7c9f7 -[UIViewController _addChildViewController:] + 263
	6   UIKitCore                           0x0000000122c7cd02 -[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 629
	7   ssgapp                              0x000000010097d934 -[RNNSideMenuController setControllers:] + 628
	8   ssgapp                              0x000000010097cfa0 -[RNNSideMenuController initWithLayoutInfo:creator:childViewControllers:options:defaultOptions:presenter:eventEmitter:] + 272
	9   ssgapp                              0x000000010095f857 -[RNNControllerFactory createSideMenu:] + 391
	10  ssgapp                              0x000000010095e9f3 -[RNNControllerFactory fromTree:] + 451
	11  ssgapp                              0x000000010095e538 -[RNNControllerFactory createLayout:] + 72
	12  ssgapp                              0x0000000100958c99 -[RNNCommandsHandler setRoot:commandId:completion:] + 1209
	13  ssgapp                              0x00000001009564d4 -[RNNBridgeModule setRoot:layout:resolver:rejecter:] + 308
	14  CoreFoundation                      0x000000010b6cb19c __invoking___ + 140
	15  CoreFoundation                      0x000000010b6c84c3 -[NSInvocation invoke] + 302
	16  CoreFoundation                      0x000000010b6c8733 -[NSInvocation invokeWithTarget:] + 70
	17  ssgapp                              0x00000001007f7e20 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2528
	18  ssgapp                              0x000000010088533b _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 731
	19  ssgapp                              0x0000000100884eb2 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 98
	20  ssgapp                              0x0000000100884e49 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
	21  libdispatch.dylib                   0x000000010af683ec _dispatch_call_block_and_release + 12
	22  libdispatch.dylib                   0x000000010af696d8 _dispatch_client_callout + 8
	23  libdispatch.dylib                   0x000000010af7848c _dispatch_main_queue_drain + 1420
	24  libdispatch.dylib                   0x000000010af77ef2 _dispatch_main_queue_callback_4CF + 31
	25  CoreFoundation                      0x000000010b620b34 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	26  CoreFoundation                      0x000000010b61b46f __CFRunLoopRun + 2463
	27  CoreFoundation                      0x000000010b61a6ed CFRunLoopRunSpecific + 557
	28  GraphicsServices                    0x000000011672e08f GSEventRunModal + 137
	29  UIKitCore                           0x00000001236616ee -[UIApplication _run] + 972
	30  UIKitCore                           0x000000012366616e UIApplicationMain + 1

RCTFatal
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0

Mac Configuration

React Native Environment Info:
    System:
      OS: macOS 14.4.1
      CPU: (8) arm64 Apple M1
      Memory: 85.22 MB / 16.00 GB
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
      Yarn: 1.22.22 - /opt/homebrew/bin/yarn
      npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    IDEs:
      Xcode: 15.4/15F31d - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.9 => 0.59.9

Depedencies

{
  "dependencies": {
    "@react-native-community/toolbar-android": "0.1.0-rc.2",
    "axios": "0.18.0",
    "moment": "2.24.0",
    "react": "16.8.3",
    "react-currency-formatter": "1.1.0",
    "react-moment": "0.8.4",
    "react-native": "0.59.9",
    "react-native-animatable": "1.3.3",
    "react-native-camera": "1.4.3",
    "react-native-collapsible": "1.4.0",
    "react-native-deck-swiper": "1.5.22",
    "react-native-extra-dimensions-android": "1.2.5",
    "react-native-fingerprint-scanner": "2.6.1",
    "react-native-firebase": "5.5.0",
    "react-native-modal": "11.5.3",
    "react-native-modal-selector": "1.0.3",
    "react-native-navigation": "2.21.1",
    "react-native-table-component": "1.2.1",
    "react-native-ui-kitten": "3.1.2",
    "react-native-vector-icons": "6.6.0",
    "react-native-version-number": "0.3.4",
    "react-redux": "5.0.7",
    "redux": "4.0.0",
    "redux-saga": "0.16.0"
  },
  "devDependencies": {
    "babel-eslint": "8.2.3",
    "babel-jest": "23.6.0",
    "eslint": "4.19.1",
    "eslint-config-airbnb": "16.1.0",
    "eslint-plugin-import": "2.12.0",
    "eslint-plugin-jsx-a11y": "6.0.3",
    "eslint-plugin-react": "7.9.1",
    "graceful-fs": "4.2.6",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.6.1",
    "reactotron-react-native": "2.0.0",
    "reactotron-redux": "2.0.0",
    "reactotron-redux-saga": "2.0.0",
    "redux-mock-store": "1.5.3"
  },
}

What was the expected behaviour?

I tried to do the process in Xcode 15.3 and used yarn install --ignore-engines.

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: 2.21.1
React Native version: 0.59.9
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version: 16.20.2
Device model: iPhone 15
iOS version: 17

@gern132
Copy link

gern132 commented May 27, 2024

have same error

react-native: 0.64.1
ios version: 17.4/17.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants