This is a migrated thread and some comments may be shown as answers.

Location module and ios emulator

5 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rasmus
Top achievements
Rank 1
Rasmus asked on 12 Mar 2015, 11:49 AM
Hi

I'm currently testing some features concerning the location module. So far i'm only trying basic stuff like checking if location is enabled an getting current location.
However i'm having issues testing the location module on my ios simulator. So far it returns false to LocationManager.isEnabled() and null to locationManager.lastKnownLocation;

I've set a custom location in Debug -> Location in my iOS simulator. I've also checked, that location is enabled in iOS settings of my iOS simulator.

My code looks like this (extracts):

var LocationModule = require("location");
var LocationManager = LocationModule.LocationManager;
[...]
var locationManager = new LocationManager();
var isEnabled = LocationManager.isEnabled();
var lastKnownLocation = locationManager.lastKnownLocation;

Anything i'm missing, or is location only testable on a real device?

5 Answers, 1 is accepted

Sort by
0
Rasmus
Top achievements
Rank 1
answered on 12 Mar 2015, 09:47 PM
Ok i've done some more testing and debugging during the day. Still haven't found a working solution though. But feels like i've gotten a little further:

I tested the app on an iPhone 6 with newest iOS 8.2 - same result as in the emulator. If using the sample code from the docs: http://docs.nativescript.org/ApiReference/location/HOW-TO.html#get-location-once , i get an error message in the console saying: Location service is disabled.

I've been googling and found that my app might miss the permission to use the location parameters. But how do i ask for this permission? Some threads on the web suggest adding permission to the .plist-file of the app. I can't seem to find any documentation on what to add though. Any help or nudge in the right direction is highly appreciated.

Best regards
0
Erjan Gavalji
Telerik team
answered on 13 Mar 2015, 01:21 PM
Hi Rasmus,

Indeed, the iOS simulator does not ask for permissions every time and fails reporting the location when requested. The workaround for that is to reset the simulator (iOS Simulator -> Reset Content and Settings menu) and start the application each time you test it.

Kind regards,
Erjan Gavalji
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rasmus
Top achievements
Rank 1
answered on 16 Mar 2015, 10:04 PM
Hi again Erjan

Ok i guess i'm on the rigt path in regards to the missing clearance of using the location service.

However i tried resetting content and settings - no luck, though? When er do a 'tns run ios --emulator' it seems to reboot my simulator, maybe this swipes the reset-action?

As i wrote i tried the same while running my app on my iPhone 6 also without any luck.

So to sum it up:
1) Am i doing the reset correct? (opening simulator, choosing iOS Simulator -> Reset Content And Settings and then running my app from CLI with 'tns run ios --emulator'.
2) How do i actually make my app ask for permission to use the location service? (and if not possible in the simulator, how to do it while testing on my real device?)

Thanks for your reply, and i hope you'll be able to answer my follow ups.

Best regards,
0
Erjan Gavalji
Telerik team
answered on 20 Mar 2015, 03:32 PM
Hi Rasmus,

Sorry for not replying earlier, we're in the preparation of the next release and the situation is hectic.

Anyways, I drilled down some more into the location module today and indeed, there are a bug in the location module for ios 7.1 and a change in ios 8 that stop the module at all.

I hope this is not as critical for you. We are preparing a fix, which will be available with the next official release.

If urgent, I can send you a package with the fix for ios8. Note that it will only have passed automatic tests, no full QA testing passed.

Kind regards,
Erjan Gavalji
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rasmus
Top achievements
Rank 1
answered on 22 Mar 2015, 12:09 AM
Hi Erjan

Thanks for the reply. Happy to know it wasn't just me overlooking some deatil. I'll look forward to test it again with the official release - so far it is not an urgent matter for me, so waiting for the official release should be fine. But thanks for the offer anyway!

Best regards
Tags
General Discussions
Asked by
Rasmus
Top achievements
Rank 1
Answers by
Rasmus
Top achievements
Rank 1
Erjan Gavalji
Telerik team
Share this question
or