Skip to content

VSCode debugger crashes on old simulators #1084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DimitarTachev opened this issue Feb 18, 2019 · 1 comment
Closed

VSCode debugger crashes on old simulators #1084

DimitarTachev opened this issue Feb 18, 2019 · 1 comment
Assignees
Milestone

Comments

@DimitarTachev
Copy link
Contributor

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

Describe the bug

To Reproduce

  1. tns create jsApp --js && cd jsApp && code .
  2. Replace your onTap method with the one below:
viewModel.onTap = (args) => {
    const btn = args.object;
    const native = btn.nativeView;
    console.log(native);
};
  1. Set a breakpoint inside the above-mentioned method.
  2. Start an old simulator (<11.0) e.g. with iPhone 6 with iOS 9.3.
  3. Click Launch on iOS from VSCode.
  4. Try to inspect the nativeView of the button.
  5. You will get [UIButton adjustsImageSizeForAccessibilityContentSizeCategory]: unrecognized selector sent to instance exception and the app will crash (this property is introduced in iOS 11).

Expected behavior
The iOS runtime should not return properties for newer iOS version through the debug protocol. In this case the returned properties should be for iOS <=9.3.

@mbektchiev mbektchiev added this to the 5.2.1 milestone Feb 22, 2019
@mbektchiev mbektchiev self-assigned this Feb 22, 2019
mbektchiev added a commit that referenced this issue Feb 25, 2019
* Add `isImplementedInClass` and `isAvailableInClass` methods in
`PropertyMeta` and `MethodMeta` which additionally check whether a Class
instance supports a given optional method
* Use `isAvailableInClass` instead of `isAvailable` in `getOwnPropertySlot` of
`ObjCPrototype`, `ObjCConstructorBase`, `ObjCConstructorNative`
* Add `findInterfaceMeta` function with fallback to base interface
if the desired one is unavailable in the current SDK version
* Add `encodeVersion` `getMajorVersion` and `getMinorVersion` helpers
* Remove hacky patch from `ObjCMethodWrapper::preInvocation` which
fixed the symptoms of #978 but not its root cause
* Modify fixtures and add test cases for methods availability in
`InheritanceTests.js`
* Add test case for unavailable base class

refs #1084
mbektchiev added a commit that referenced this issue Feb 25, 2019
* Respect availability attribute in protocols
* Fix typo Protcols -> Protocols
* Add tests

refs #1084
@mbektchiev
Copy link
Contributor

mbektchiev commented Feb 25, 2019

The bug is caused by adjustsImageSizeForAccessibilityContentSizeCategory being declared without availability attributes while at the same time its defining protocol UIAccessibilityContentSizeCategoryImageAdjusting is declared available since iOS 11.0

mbektchiev added a commit that referenced this issue Feb 25, 2019
* Respect availability attribute in protocols
* Fix typo Protcols -> Protocols
* Add tests

refs #1084
mbektchiev added a commit that referenced this issue Feb 27, 2019
* Respect availability attribute in protocols
* Add tests

refs #1084
@mbektchiev mbektchiev modified the milestones: 5.2.1, 5.3.0 Feb 27, 2019
mbektchiev added a commit that referenced this issue Feb 27, 2019
* Respect availability attribute in protocols
* Add tests

refs #1084
mbektchiev added a commit that referenced this issue Feb 28, 2019
Apple regularly create new protocols and move existing
interface members there. E.g. iOS 12.0 introduced the
UIFocusItemScrollableContainer protocol in UIKit which
contained members that have existed in UIScrollView
since iOS 2.0.

* Create `findProtocol` function in `GlobalTable`
* Use it instead of `findMeta` everwhere where a
protocol is looked for
* Add tests

refs #1084
mbektchiev added a commit that referenced this issue Feb 28, 2019
Apple regularly create new protocols and move existing
interface members there. E.g. iOS 12.0 introduced the
UIFocusItemScrollableContainer protocol in UIKit which
contained members that have existed in UIScrollView
since iOS 2.0.

* Create `findProtocol` function in `GlobalTable`
* Use it instead of `findMeta` everwhere where a
protocol is looked for
* Add tests

refs #1084
@Natalia-Hristova Natalia-Hristova self-assigned this Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants