Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

How to run react-native app with offline bundle in real device?

$
0
0

I have wrote some code, and things run well on simulator. And I checked the official document on how to run on device. This is what I have done:

1,comment this line in AppDelegate.m

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];

2,uncomment:

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

And they say

'The static bundle is automatically generated by the "Bundle React Native code and images" build step when running the project on an actual device'

I clicked 'run', and red screen appeared:'connect refused'. To ensure the main.jsbundle IS in the project, I manually generate it with the curl command. But the error still there:

Websocket connection failed with error ErrorDomain=NSPOSIXErrorDomain Code=61 'connection refused'

Hours in googling, but got no help.


Viewing all articles
Browse latest Browse all 16750

Trending Articles