birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
142 stars 22 forks source link

iOS Example fails with New Architecture/Fabric enabled #47

Closed glenlindquist closed 1 year ago

glenlindquist commented 1 year ago

Enabling fabric and the New Architecture for iOS causes the example app to crash upon launch. Fabric/New Architecture appear to work correctly for Android.

Steps to reproduce:

XCode logs reveal:

2023-06-27 09:36:44.491991-0500 ReactNativeStaticServerExample[47479:358047] [javascript] Running "ReactNativeStaticServerExample
2023-06-27 09:36:44.528769-0500 ReactNativeStaticServerExample[47479:358047] [javascript] 'Server #4417.\n', 'Origin: ', 'New state: "STARTING".\n', 'Details: "".'
2023-06-27 09:36:45.275441-0500 ReactNativeStaticServerExample[47479:358041] -[ReactNativeStaticServer getOpenPort:resolve:reject:]: unrecognized selector sent to instance 0x600001b23f00
2023-06-27 09:36:45.293468-0500 ReactNativeStaticServerExample[47479:358041] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ReactNativeStaticServer getOpenPort:resolve:reject:]: unrecognized selector sent to instance 0x600001b23f00'
glenlindquist commented 1 year ago

If I specify a port when I create the server, then the logs show:

2023-06-27 10:06:12.478396-0500 ReactNativeStaticServerExample[60694:468044] [javascript] 'Server #2897.\n', 'Origin: ', 'New state: "STARTING".\n', 'Details: "".'
2023-06-27 10:06:12.758685-0500 ReactNativeStaticServerExample[60694:468028] -[ReactNativeStaticServer start:configPath:errlogPath:resolve:reject:]: unrecognized selector sent to instance 0x600000912400
2023-06-27 10:06:12.787730-0500 ReactNativeStaticServerExample[60694:468028] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ReactNativeStaticServer start:configPath:errlogPath:resolve:reject:]: unrecognized selector sent to instance 0x600000912400'
birdofpreyru commented 1 year ago

Does it happen with RN v0.71.x, or the latest v0.72.0?

glenlindquist commented 1 year ago

This was with 0.71.10.

glenlindquist commented 1 year ago

Was curious, so I just ran an RN upgrade from 0.71.10 -> 0.72.0 in the example app and I'm seeing the same behavior.

birdofpreyru commented 1 year ago

Hey, @glenlindquist I just had a quick look at it after upgrading the library to RN@0.72.1 myself (the code in dev-0.8 branch, commit ffefc86a2f7f0ff14b6a24438c21e462bc231c80), and it seems to work fine for me. Can you test with that version?

birdofpreyru commented 1 year ago

Closing, assuming it is not an issue anymore.