mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 19:15:05 +00:00
Add docs about running on device
This commit is contained in:
parent
48a993b5c5
commit
475a954951
42
docs/RunningOnDevice.md
Normal file
42
docs/RunningOnDevice.md
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
id: runningondevice
|
||||
title: Running On Device
|
||||
layout: docs
|
||||
category: Guides
|
||||
permalink: docs/runningondevice.html
|
||||
next: embedded-app
|
||||
---
|
||||
|
||||
Note that running on device requires [Apple Developer account](https://developer.apple.com/register/index.action) and provisioning your iPhone. This guide covers only React Native specific topic.
|
||||
|
||||
## Accessing development server from device
|
||||
|
||||
You can iterate quickly on device using development server. To do that, your laptop and your phone have to be on the same wifi network.
|
||||
|
||||
1. Open `iOS/AppDelegate.m`
|
||||
2. Change the IP in the URL from `localhost` to your laptop's IP
|
||||
3. In Xcode select your phone as build target and press "Build and run"
|
||||
|
||||
> Hint
|
||||
>
|
||||
> Shake the device to open developemt menu (reload, debug, etc.)
|
||||
|
||||
## Using offline bundle
|
||||
|
||||
You can also pack all the JavaScript code within the app itself. This way you can test it without development server running and submit the app to the AppStore.
|
||||
|
||||
1. Open `iOS/AppDelegate.m`
|
||||
2. Follow the instructions for "OPTION 2":
|
||||
* Uncomment `jsCodeLocation = [[NSBundle mainBundle] ...`
|
||||
* Run given `curl` command in terminal from the root directory of your app
|
||||
|
||||
Packager supports a couple of options:
|
||||
|
||||
* `dev` (true by default) - sets the value of `__DEV__` variable. When `true` it turns on a bunch of useful development warnings. For production it is recommended to use `dev=false`.
|
||||
* `minify` (false by default) - whenever or not to pipe the JS code through UglifyJS.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If `curl` command fails make sure the packager is running. Also try adding `--ipv4` flag to the end of it.
|
||||
|
||||
If you started your project a while ago, `main.jsbundle` might not be included into Xcode project. To add it, right click on your project directory and click "Add Files to ..." - choose the `main.jsbundle` file that you generated.
|
@ -4,7 +4,7 @@ title: Testing
|
||||
layout: docs
|
||||
category: Guides
|
||||
permalink: docs/testing.html
|
||||
next: embedded-app
|
||||
next: runningondevice
|
||||
---
|
||||
|
||||
## Running Tests and Contributing
|
||||
|
Loading…
x
Reference in New Issue
Block a user