NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

{N} app crashes when inspecting SearchBar with VSCode debugger

DimitarTachev opened this issue · comments

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.2.0
  • Cross-platform modules: 5.2.0
  • iOS Runtime: 5.2.0

To Reproduce

  1. tns create jsApp --js && cd jsApp && code .
  2. Replace the <Button with a <SearchBar.
  3. Replace your onTap method with the one below:
viewModel.onTap = (args) => {
    const sb = args.object;
    const native = sb.nativeView;
    console.log(native);
};
  1. Set a breakpoint inside the above-mentioned method.
  2. Start a simulator e.g. iPhone X with iOS 12.1.
  3. Click Launch on iOS from VSCode.
  4. Try to inspect the nativeView of the SearchBar.
  5. The VSCode debugging will crash and the app will freeze.

The reason for the issue is that optional unimplemented methods were returned as supported by the JS wrapper object.
It lead to crashes only on Simulator because of #1044, on real devices it only logs errors when the VS Code debugger tries to read their values:

-[UISearchBarImpl collisionBoundingPath]: unrecognized selector sent to instance 0x106142820

-[UISearchBarImpl collisionBoundsType]: unrecognized selector sent to instance 0x106142820

-[UISearchBarImpl coordinateSpace]: unrecognized selector sent to instance 0x106142820