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

App instantly crashes in v0.53.3 on iOS due to a low-level RedBox error #18090

Closed
Nickersoft opened this issue Feb 26, 2018 · 11 comments
Closed
Labels
Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Nickersoft
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.5.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3

Steps to Reproduce

I'm not entirely sure, as there's a chance it might have to do with XCode, Objective-C, or something else low-level. After upgrading to v0.53.3, my app instantly crashes the minute it loads. I removed my ios directory, ejected the project and re-linked all my dependencies and received the same error. Running react-native log-ios outputs an Objective-C runtime error that I'm not quite sure how to interpret (see below).

Expected Behavior

I imagined there would be some RedBox errors after upgrading, but the app now crashes before it can even display those errors due to a runtime issue.

Actual Behavior

The app crashes. Running react-native log-ios I see the following output:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView heightAnchor]: unrecognized selector sent to instance 0x7fde20865400'
	*** First throw call stack:
	(
		0   CoreFoundation                      0x000000010b8ccf35 __exceptionPreprocess + 165
		1   libobjc.A.dylib                     0x000000010aa28bb7 objc_exception_throw + 45
		2   CoreFoundation                      0x000000010b8d404d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
		3   CoreFoundation                      0x000000010b82c27c ___forwarding___ + 988
		4   CoreFoundation                      0x000000010b82be18 _CF_forwarding_prep_0 + 120
		5   MyApp                               0x0000000109e6bd2c -[RCTRedBoxExtraDataViewController init] + 2524
		6   MyApp                               0x0000000109ed11f6 __55-[RCTRedBox showErrorMessage:withParsedStack:isUpdate:]_block_invoke + 70
		7   libdispatch.dylib                   0x000000010e6b0af6 _dispatch_call_block_and_release + 12
		8   libdispatch.dylib                   0x000000010e6caaf4 _dispatch_client_callout + 8
		9   libdispatch.dylib                   0x000000010e6b6265 _dispatch_main_queue_callback_4CF + 490
		10  CoreFoundation                      0x000000010b834fe9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
		11  CoreFoundation                      0x000000010b7f7eeb __CFRunLoopRun + 2043
		12  CoreFoundation                      0x000000010b7f7486 CFRunLoopRunSpecific + 470
		13  GraphicsServices                    0x000000010fb549f0 GSEventRunModal + 161
		14  UIKit                               0x000000010d2c5420 UIApplicationMain + 1282
		15  MyApp                               0x0000000109d93caf main + 111
		16  libdyld.dylib                       0x000000010e6fa145 start + 1
		17  ???                                 0x0000000000000001 0x0 + 1
	)

Checking RCTRedBoxExtraDataViewController.m, I saw the "heightAnchor" calls the error is referencing. That said, I'm not exactly sure how to approach this issue or why it might be happening in the first place. If I had any clue what kind of RedBox error it might be trying to throw or what is causing that error I'd have a better shot of replicating it, but right now I'm rather in the dark.

Any idea what could trip up the RedBox system like that? Is there another way to view what error it's trying to throw so I can at least better understand why the error is causing the app to crash? Any help is appreciated. Thanks.

@Nickersoft
Copy link
Author

Nickersoft commented Feb 26, 2018

Update: so it would seem this issue is happening for all errors, even when I manually throw errors. My index.js looks like this:

    const EntryPoint = props => {
        throw new Error("This is an error");
        return null;
    };

    AppRegistry.registerComponent('MyApp', () => EntryPoint);

And throwing the error causes my app to immediately crash with the same ObjC error. Removing the error just causes a white page, as expected. I headed on over to the Expo Snack site to try to replicate the issue, but the highest RN version Expo supports right now is v0.52, so I couldn't test on the latest version. This issue doesn't seem to be present in v0.52.

Hopefully this helps. It's looking like it might be a RN library issue, or at the very least some XCode incompatibility wonkiness.

@Nickersoft
Copy link
Author

Nickersoft commented Feb 27, 2018

Update #2: Running via XCode prevents the app from crashing. Not sure why. It only seems to crash when I run via react-native run-ios. Perhaps a CLI build issue..?

@Nickersoft
Copy link
Author

After running in XCode, the CLI run command seems to be working again. Closing for now. Will re-open if issue arises again.

@Nickersoft Nickersoft reopened this Mar 8, 2018
@Nickersoft
Copy link
Author

So the issue seems to be tied to running the app on the iPhone 6, the default when running from the command-line. In XCode, it was defaulting to iPhone 8, which runs the app just fine. However, running an iPhone 6 sim from XCode still causes the app to crash, with the same error message.

@hramos hramos added the Platform: iOS iOS applications. label Mar 13, 2018
@scottmas
Copy link

scottmas commented Apr 3, 2018

I can confirm this on iphone 5 as well, running RN 54. And similar to Nick, it does work on iPhone 8. I get the exact same stack trace inside Xcode on any JS exception.

@nic-thomson
Copy link

nic-thomson commented Apr 11, 2018

I believe this is actually an iOS 8 issue,
[UITableView heightAnchor]: unrecognized selector sent...
is the key.
Does not work simulator iPhone 6 iOS 8.4
Works on simulator iPhone 6 iOS 9.3

@poison
Copy link

poison commented Apr 25, 2018

I'm experiencing the same issue

-[UITableView heightAnchor]: unrecognized selector sent to instance 0x15099600
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView heightAnchor]: unrecognized selector sent to instance 0x15099600'

Ran from Xcode (not the command-line) on iOS 8.1.2, iPhone 5

@asolas
Copy link

asolas commented May 21, 2018

NSLayoutDimension *heightAnchor NS_AVAILABLE_IOS(9_0)

find this define
so the Deployment Target need to set >= 9.0
or check before _tableView.heightAnchor and do something fix this issue

@Willemvlaar
Copy link

Just comment out these lines in RCTRedBoxExtraDataViewController.m:

//CGFloat tableHeight = self.view.bounds.size.height - 60.f;
//[_tableView.heightAnchor constraintEqualToConstant:tableHeight].active = YES;
//[_tableView.widthAnchor constraintEqualToAnchor:self.view.widthAnchor].active = YES;

//CGFloat buttonWidth = self.view.bounds.size.width / 4;
//[dismissButton.heightAnchor constraintEqualToConstant:60].active = YES;
//[dismissButton.widthAnchor constraintEqualToConstant:buttonWidth].active = YES;
//[reloadButton.heightAnchor constraintEqualToConstant:60].active = YES;
//[reloadButton.widthAnchor constraintEqualToConstant:buttonWidth].active = YES;

I tried debugging and the _tableView, dismissButton and reloadButton objects don't have heightAnchor or widthAnchor values.

@stale
Copy link

stale bot commented Oct 1, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 1, 2018
@stale
Copy link

stale bot commented Oct 8, 2018

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Oct 8, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

7 participants