I have read the documentation and made the following
On iOS devices, open the file RCTWebSocketExecutor.m and change "localhost" to the IP address of your computer, then select "Debug JS Remotely" from the Developer Menu.
NSString *host = [[_bridge bundleURL] host];
if (!host) {
host = @"192.168.1.114";
}
NSString *URLString = [NSString stringWithFormat:@"http://%@:%zd/debugger-proxy?role=client", host, port];
_url = [RCTConvert NSURL:URLString];
But after turning on remote debugging on a device, I saw only a white screen.
When i change AppDelegate.m
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.114:8081/index.ios.bundle?platform=ios&dev=true&minify=false"];
and after these changes, remote debugging works.
I am not sure, but earlier i have exception on this code.
var messageHandlers = {
'executeApplicationScript': function(message, sendReply) {
for (var key in message.inject) {
self[key] = JSON.parse(message.inject[key]);
}
var error;
try {
importScripts(message.url);
} catch (err) {
error = JSON.stringify(err);
}
sendReply(null /* result */, error);
},
'setDebuggerVisibility': function(message) {
visibilityState = message.visibilityState;
},
};
I did the change in the Library React/Base/RCTBundleURLProvider
method guessPackagerHost
Because everything I've seen depends on the values there. This works for me.
The drawback is, as it is in node_modules it is cleaned out.
I also wished for an easier solution. Debugging on (ios) device is something very basic and there should really be configuration options. Maybe in the applications setting panel (only if debug). ipguess with fallback to localhost and this ip.txt is an ugly hack in my opinion and does only cover most simple use cases.
Maybe react-native team know how this can be fixed?
I had a similar issue on android. Closing the remote-debugger tab and recreating a new one by selecting "Debug JS remotely" did the trick.
Is the same issue? Blank white screen when trying to debug React Native app on iOS simulator
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
i have this problem for fix this problem add localhost in NSAppTransportSecurity of file info.plist
@Maxim-Chugaev it seems happening for me now and here is the details of my App Settings with the Mac OSX Environment Details, please validate it and looking for a early reply as i have been blocked to release my app to store :P
in iOS/AppDelegate.m...
Before : jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; (No bundle url issue came then i chnaged to : jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.bundle?platform=ios&dev=true"]; ) it works perfectly fine for me.
But when i released a build for testing (Steps=> Set the Provisional Profile and developer certificate=> Set Generic Device=>Product Achieve=> Released through HockeyApp=> After Installing the app in iOS Device => App stuck on blank white screen after Splash Screen)
I have attached my system configuration details.
Most helpful comment
Maybe react-native team know how this can be fixed?