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

[TIMOB-20217] iOS: Ti.Geolocation.hasGeolocationPermission() and Ti.Geolocation.getCurrentPosition() are not working on IOS 7 - fix for TI_USE_KROLL_THREAD #7656

Merged
merged 1 commit into from Feb 2, 2016

Conversation

sriks
Copy link
Contributor

@sriks sriks commented Jan 31, 2016

This requires that creation of location delegate and subsequent permission alert are presented on main thread. This is because by default JS runs on its own thread enabled by TI_USE_KROLL_THREAD.

…eolocation.getCurrentPosition() are not working on IOS 7 - fix for TI_USE_KROLL_THREAD
// It is required that delegate is created and permission is presented in main thread.
TiThreadPerformOnMainThread(^{
[self requestLocationPermissioniOS7:args];
}, NO);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any dependency to the TI_USE_KROLL_THREAD, did you test it with both <run-on-mainthread/> and without? Just want to double-check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually when we run on Studio the JS is executed in a separate thread. <run-on-mainthread/> is false by default. But the permission are required to be presented on main thread.

But when we run in XCode TI_USE_KROLL_THREAD is not defined, which makes JS run on main thread. So it very easy to miss on background thread related issues. This fix is one of them.
This can be tested by defining and un-defining TI_USE_KROLL_THREAD in defines.h. Should work in both cases.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. But if thats the case, we definitely need to make the Xcode builds behave the same as the actual ti build -p ios builds. Would it make sense to define it by default in the Xcode project? Should be the same with <use-autolayout/> that triggers a different behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I highly recommend that TI_USE_KROLL_THREAD is defined by default in our code base. This makes the Xcode build behave as expected. Actually it is quite easy to miss these thread related issues :(
About this got to check with Kiat.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. At least if we keep the main thread enabled by default. But as far as I know, I should get enabled by default starting in 6.0.0 in favor of Hyperloop. /cc @cheekiatng

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure we can make TI_USE_KROLL_THREAD default for now in our code base. However, there's a blocker for setting it to default starting in 6.0.0 due to https://jira.appcelerator.org/browse/TIMOB-19762.

@hansemannn
Copy link
Collaborator

As discussed in the standup, we'll go with this fix and have the TI_USE_KROLL_THREAD in mind for 6.0.0. Approved!

hansemannn added a commit that referenced this pull request Feb 2, 2016
[TIMOB-20217] iOS: Ti.Geolocation.hasGeolocationPermission() and Ti.Geolocation.getCurrentPosition() are not working on IOS 7 - fix for TI_USE_KROLL_THREAD
@hansemannn hansemannn merged commit df50010 into tidev:master Feb 2, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants