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
Conversation
…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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
As discussed in the standup, we'll go with this fix and have the |
[TIMOB-20217] iOS: Ti.Geolocation.hasGeolocationPermission() and Ti.Geolocation.getCurrentPosition() are not working on IOS 7 - fix for TI_USE_KROLL_THREAD
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
.