Location module and ios emulator

Thread is closed for posting
6 posts, 0 answers
  1. Rasmus
    Rasmus avatar
    4 posts
    Member since:
    Jan 2014

    Posted 12 Mar 2015 Link to this post

    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?
  2. Rasmus
    Rasmus avatar
    4 posts
    Member since:
    Jan 2014

    Posted 12 Mar 2015 in reply to Rasmus Link to this post

    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
  3. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 13 Mar 2015 Link to this post

    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.

     
  4. Rasmus
    Rasmus avatar
    4 posts
    Member since:
    Jan 2014

    Posted 16 Mar 2015 in reply to Erjan Gavalji Link to this post

    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,
  5. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 20 Mar 2015 Link to this post

    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.

     
  6. Rasmus
    Rasmus avatar
    4 posts
    Member since:
    Jan 2014

    Posted 21 Mar 2015 in reply to Erjan Gavalji Link to this post

    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
Back to Top