Skip to content

Commit

Permalink
Merge pull request NativeScript#1654 from NativeScript/bektchiev/upda…
Browse files Browse the repository at this point in the history
…te-ios-runtime-debug-article

docs: Update iOS Runtime debugging article
  • Loading branch information
mbektchiev authored May 9, 2019
2 parents 0886c28 + 7b84cf0 commit 40dc25e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NS_UI_SM=$SCRIPT_PATH"/../../nativescript-ui-samples"
NS_UI_SM_NG=$SCRIPT_PATH"/../../nativescript-ui-samples-angular"
NS_UI_DOCS=$DOCS_ROOT"/ns_ui_docs"

[ ! -d "$ROOT" ] && rm -rf $ROOT
[ ! -d "$ROOT" ] || rm -rf $ROOT

mkdir $ROOT

Expand Down
25 changes: 13 additions & 12 deletions docs/core-concepts/ios-runtime/how-to/debug-ios-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,41 @@ NativeScript with plain JavaScript:

> **WARNING**: Make sure your environment fulfills all the requirements mentioned in [ios-runtime](https://github.com/NativeScript/ios-runtime)'s README.
### 1. Create a `cmake-build` folder in the already cloned ios-runtime repository
### 1. Enter the cloned ios-runtime directory

`cd ios-runtime`

`mkdir cmake-build && cd cmake-build`

### 2. Generate the XCode project

> **WARNING**: By default the generated XCode project builds the Runtime as a static library. In order to build it as a dynamic library you should pass the `BUILD_SHARED_LIBS=1` flag to CMake.
`cmake .. -GXcode -DBUILD_SHARED_LIBS=1`
`./cmake-gen.sh`

### 3. Build the Nativescript.xcodeproj *Nativescript* target
### 3. Build the NativeScript.xcodeproj *NativeScript* target

![Build NS](build-dynamic-target.png)

## Add the iOS Runtime .xcodeproj to your application's one and start debugging

### 1. Close *Nativescript.xcodeproj* and drag it into your application's .xcodeproj
### 1. Close *NativeScript.xcodeproj* and drag it into your application's .xcodeproj
![Drag xcodeproj](drag-runtime-proj.png)

> **IMPORTANT**: If you drag it from the Runtime's xcodeproj you will get an error, thus drag it from Finder after closing *Nativescript.xcodeproj*
> **IMPORTANT**: If you drag it from Xcode where the Runtime's xcodeproj is currently open you will
get an error, thus drag it from Finder after closing *NativeScript.xcodeproj*

### 2. Connect the framework you've just built to the application:

##### Select your app target and go to General tab. Then under *Embedded binaries* select the `+` button and add `Nativescript.framework`
##### Select your app target and go to General tab. Then under *Embedded binaries* select the `+` button and add `NativeScript.framework`

![Go to General](general-embed-binaries.png)

![Select NS Framework](select-ns-framework.png)

### 3. Let's try to change a function's implementation and set a breakpoint there:
### 3. Disable the NativeScript PostBuild build step which embeds the original NativeScript.framework
Open the **Build Phases** tab, expand the ***NativeScript PostBuild*** section and comment the
script invocation by changing **`$SRCROOT/internal/nativescript-post-build`** to ***`# $SRCROOT/internal/nativescript-post-build`***

### 4. Let's try to change a function's implementation and set a breakpoint there:
![Set breakpoint](set-breakpoint.png)

### 4. If you run the application project you should hit the breakpoint and see the printed text in the console:
### 5. If you run the application project you should hit the breakpoint and see the printed text in the console:

![Hit breakpoint](hit-breakpoint.png)

0 comments on commit 40dc25e

Please sign in to comment.