Skip to content
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

Modules does not support iOS9 #740

Closed
teobugslayer opened this issue Sep 15, 2015 · 17 comments
Closed

Modules does not support iOS9 #740

teobugslayer opened this issue Sep 15, 2015 · 17 comments

Comments

@teobugslayer
Copy link

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.

@fealebenpae
Copy link
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.

@nsndeck nsndeck self-assigned this Sep 15, 2015
@hshristov
Copy link
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.

@fealebenpae
Copy link
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.

nsndeck pushed a commit that referenced this issue Sep 15, 2015
nsndeck pushed a commit that referenced this issue Sep 15, 2015
nsndeck pushed a commit that referenced this issue Sep 15, 2015
@tjvantoll
Copy link
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)

@ignaciofuentes
Copy link

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.

@fealebenpae
Copy link
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.

@eugeneniemand
Copy link

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?

@eugeneniemand
Copy link

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

@valentinstoychev valentinstoychev added this to the 1.5 (Under Review) milestone Sep 30, 2015
@bradmartin
Copy link
Contributor

+1

@toddanglin
Copy link

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?

@toddanglin
Copy link

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!

@jbristowe
Copy link
Contributor

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

@bradmartin
Copy link
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)
.

@toddanglin
Copy link

@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.

@NathanaelA

This comment was marked as abuse.

@bradmartin
Copy link
Contributor

Thanks @toddanglin and @NathanaelA

@enchev enchev added the done label Oct 12, 2015
@enchev enchev modified the milestones: 1.4.0, 1.5 (Under Review) Oct 12, 2015
@enchev enchev closed this as completed Oct 12, 2015
@lock
Copy link

lock bot commented Aug 30, 2019

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.

@lock lock bot unassigned nsndeck Aug 30, 2019
@lock lock bot locked and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests