Skip to content

Modules does not support iOS9 #740

Closed

Description

@teobugslayer

Apple has made a change in the API and NSNotFound is converted from an enum to a constant.

This breaks the apps in iOS9 and Xcode 7 emulator which uses it by default.

Activity

  1. fealebenpae commented on Sep 15, 2015

    @fealebenpae
    Contributor

    The NativeScript for iOS runtime doesn't support compile-time Objective-C constants, but we're working on adding support for them.

    However, it turns out that NSNotFound is defined as NSIntegerMax, which on 64bit devices is the maximum value of the int64_t type. Unfortunately, JavaScript doesn't support integers this large, so NSNotFound will end up truncated and not matching the native value. JavaScript code that relies on NSNotFound will have to find workarounds.

    @Fatme and I came up with such a workaround - instead of comparing the result of -[NSArray indexOfObject:] to NSNotFound, check whether the returned index is greater than zero and smaller than the count of elements in the array.

  2. self-assigned this
    on Sep 15, 2015
  3. hshristov commented on Sep 15, 2015

    @hshristov
    Contributor

    @fealebenpae Is it possible to return some other type (e.g. not a primitive JS type) which holds the native value? This way it will be possible to do comparison with it.

  4. fealebenpae commented on Sep 15, 2015

    @fealebenpae
    Contributor

    If we don't return a number primitive we can only return an object, and objects in JavaScript are always compared using identity equality, rather than value equality, so it wouldn't work anyway.

  5. added 3 commits that reference this issue on Sep 15, 2015
  6. tjvantoll commented on Sep 18, 2015

    @tjvantoll
    Contributor

    Just fyi I hit this in one of my apps as well. Here's the error I get when trying to use a <TabView>:

    file:///app/tns_modules/ui/tab-view/tab-view.js:168:54: JS ERROR TypeError: tabBarItem.setTitlePositionAdjustment is not a function. (In 'tabBarItem.setTitlePositionAdjustment({ horizontal: 0, vertical: -20 })', 'tabBarItem.setTitlePositionAdjustment' is undefined)

  7. ignaciofuentes commented on Sep 23, 2015

    @ignaciofuentes

    As a me too fyi,
    I am having the same issue as @tjvantoll. I tried this on both ios 9 and ios 8.4 emulator.

  8. fealebenpae commented on Sep 23, 2015

    @fealebenpae
    Contributor

    @ignaciofuentes, we say that this is an iOS 9 issue, but it's the iOS 9 SDK in Xcode 7 that's the problem, not iOS 9 itself. You can build a NativeScript app with Xcode 6.4 and it will work on iOS 9, but if you build the app with Xcode 7 and run it on iOS 8 you'll get the same problem, so that's why you had the same issue on the iOS 8.4 Simulator.

  9. eugeneniemand commented on Sep 23, 2015

    @eugeneniemand

    I also experienced this problem while trying the tab-view example as specified in the docs it crashes with the above mentioned error. Can the docs be updated with a warning or is there an ETA on a fix for this?

  10. eugeneniemand commented on Sep 29, 2015

    @eugeneniemand

    @fealebenpae Any idea when nativescript will support xCode 7 to circumvent the above mentioned crash using tab-view?

  11. added this to the milestone on Sep 30, 2015
  12. bradmartin commented on Oct 1, 2015

    @bradmartin
    Contributor

    +1

  13. toddanglin commented on Oct 10, 2015

    @toddanglin

    This is a major challenge. Cannot debug a simple Hello World app in the iOS simulator with a TabView on an up-to-date Mac. Is there a work around that can restore TabView support before v1.5?

  14. toddanglin commented on Oct 10, 2015

    @toddanglin

    Follow-up for those having the problem with TabView described above. Thanks to some quick sleuthing by @jbristowe this work around is available:

    You need to patch your local copy of tab-view.ios.js (in node_modules > tns-core-modules > ui > tab-view).

    Patch these two lines:
    Line 79: tabBarItem.titlePositionAdjustment = { horizontal: 0, vertical: -20 };
    Line 168: tabBarItem.titlePositionAdjustment = { horizontal: 0, vertical: -20 };

    Changing from a method call to a value assignment fixes the error. Thanks @jbristowe!

  15. jbristowe commented on Oct 10, 2015

    @jbristowe
    Contributor

    Looks like a fix was made a few days ago: 6a17651

  16. bradmartin commented on Oct 10, 2015

    @bradmartin
    Contributor

    How do you get the master in a project? I have searched all the docs and
    ReadMe files and don't see any npm or tns install to pull master. I want
    this assuming the fix is in the master of course. Im sure I'm overlooking
    it so any help is good to try and resolve this issue.

    On 10:23pm, Fri, Oct 9, 2015 John Bristowe notifications@github.com wrote:

    Looks like a fix was made a few days ago: 6a17651
    6a17651

    —
    Reply to this email directly or view it on GitHub
    #740 (comment)
    .

  17. toddanglin commented on Oct 10, 2015

    @toddanglin

    @bradmartin If you're just trying to fix this TabView error in a local project, just look for the tab-view.io.js file in this folder in your NativeScript project:

    (project root) > node_modules > tns-core-modules > ui > tab-view

    You should find the JS file there, and you can simply update the two lines referenced above to clear the error. This shouldn't be necessary after the next NativeScript release since the fix has been made to the TNS master branch.

  18. NathanaelA commented on Oct 10, 2015

    @NathanaelA
  19. bradmartin commented on Oct 10, 2015

    @bradmartin
    Contributor
  20. modified the milestones: 1.4.0, on Oct 12, 2015
  21. lock commented on Aug 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  22. locked and limited conversation to collaborators on Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions