Search code examples
iosibm-mobilefirstworklight-geolocation

IBM Worklight 6.1 cordova geolocation and ios 8


According to ibm site worklight hybrid apps can run for ios 8. I use worklight 6.1 and my app runs indeed for ios 8 but cordova geolocation fails.For ios 7 the app was running without any problems.

I tried to solve this by replacing the CDVLocation.h, CDVLocation.m files in the Cordova/plugin folder with the updated files that i've found here according to this post but this didn't solve my problem. How can i resolve this?

EDIT: I get the location like this :

//get device longitude and latitude
navigator.geolocation.getCurrentPosition(onLocationSuccess, onLocationError, geolocationOptions);

On android devices and ios7 this works fine and i can retrieve the location. on ios 8 the getCurrentPosition function never returns onLocationSuccess. so the onLocationError function is triggered always prompting the user either to enable the location services on his device or that a timeOut has occured.


Solution

  • Problem solved!

    First install IBM's ifix for worklight 6.1.

    Second, add the following Key / Type / Values to the info plist file of your xcode project:

    NSLocationAlwaysUsageDescription String Permissions Message for App even when not in use

    NSLocationWhenInUseUsageDescription String Permissions Message for App when in use

    Third download: CDVLocation.m file from GitHub and update your existing CDVLocation.m file by replacing the code. The file is located at CordovaLib/plugins.

    After this you should compile and access geo location services in iOS 8.

    //references:

    IBM

    Blog post