1

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.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
fnkbz
  • 1,189
  • 1
  • 12
  • 22

2 Answers2

3

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

fnkbz
  • 1,189
  • 1
  • 12
  • 22
  • FYI, only the permissions are missing; the plug-in files are OK. There are missing upgraders in 6.2 and this is currently being addressed for a near iFix release. A workaround is to simply re-create the iPhone environment and the appropriate files will be generated. – Idan Adar Oct 14 '14 at 07:30
2

Refer to the following tech note regaring iOS 8 support in Worklight 5.0.6, 6.0, 6.1 and 6.2: http://www-01.ibm.com/support/docview.wss?uid=swg21684538

The tech note also lists a known and fixed issue regarding geolocation in iOS8 when using Xcode 6.

Are you using Xcode 6? If yes, go to IBM Fix Central and download the latest available iFix for Worklight 6.1, which should resolve this issue.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • thanks! is there any installation instructions for the ifix when using the ibm worklight studio with eclipse ide? – fnkbz Oct 01 '14 at 14:09
  • You should be able to just add the repository in the Help > install new software... wizard, but you can also just use a new eclipse and follow the same to start afresh. Use either the same workspace or a new one (in which can you'll need to import the Worklight project). – Idan Adar Oct 01 '14 at 14:10
  • geolocation doesn't works even after installing the ifix.the cordova version is 3.1. – fnkbz Oct 10 '14 at 10:27
  • here is the version if u can check it Server version: 6.1.0.01.20140922-2007 Project WAR version: 6.1.0.01.20140821-0406 Application name: MyHol. Version: 6.1.0.01.20140922-2007 – fnkbz Oct 10 '14 at 12:32
  • 1
    @fnkbz, I don't think you need to change the files per your mention in the question. Use the ones provided by Worklight in make sure the the following exists in the application's plist file: NSLocationWhenInUseUsageDescription – Idan Adar Oct 10 '14 at 13:24
  • If it's still a no-go, please provide a simple test case application where this is reproducible. – Idan Adar Oct 10 '14 at 13:29
  • 1
    the issue resolved with the installation of the ifix and by adding the keys NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription and by replacing the code of the CDVLocation.m with the updated file https://github.com/apache/cordova-plugin-geolocation/blob/master/src/ios/CDVLocation.m – fnkbz Oct 10 '14 at 15:28
  • Great. I suggest that you'll write this as a new answer. – Idan Adar Oct 10 '14 at 15:30