11 Replies Latest reply on Feb 15, 2015 11:56 PM by Vincent Lagneau

    Geo Location API not working on iOS 8 ?

    Siddhant  Wadhera

      Hi

      I am new to both ruby and rhodes. I have been using Geo Location API in my app which works fine on iOS7.But when i build the app for iOS8 using Xcode 6 and rhodes4.1.1 I always get the positioning co-ordinates as 0 from the API itself.

       

      is there any workaround for this so that the API works.

       

      I tried building the app with 5.0.2 but i get an error as given below :

      ld: symbol(s) not found for architecture armv7

        ==================== ERROR! ====================

      clang: error: linker command failed with exit code 1 (use -v to see invocation)

       

      ** BUILD FAILED **

       

       

      The following build commands failed:

          Ld build/Release-iphoneos/rhorunner.app/rhorunner normal armv7

      (1 failure)

      cd /Users/varalakshmip/.rvm/gems/ruby-1.9.3-p547/gems/rhodes-5.0.2

      ************************************

      ERROR during building by XCode !

      XCode return next error code = pid 95524 exit 65

      which i could not understand


      Any help is appreciated in regards to make the GEo Location API work on iOS8???


      Thanks

      Siddhant

        • Re: Geo Location API not working on iOS 8 ?
          Kutir Mobility

          Hi Siddhant

          I see a3f8d09e-67a3-49cb-867a-909040f59619 already shared his experience about building Rhodes app for iOS8 at https://developer.motorolasolutions.com/message/81609#81609

           

          Was that helpful to you ?

          Thank you.

          Visnupriya R

          Kutir Mobility

          • Re: Geo Location API not working on iOS 8 ?

            Hi,

             

            Please post full console output for "rake run:iphone --trace" or full build log from XCode.

            If you use XCode project generated in 4.0, you should regenerate it by 5.0 (remove app_folder/project/iphone and regenerate by "rake build:iphone:setup_xcode_project")

            • Re: Geo Location API not working on iOS 8 ?

              Hi Siddhant,

               

              Your post was earlier in the month, so you may have found a work around already.

              GeoLocation API needs some changes to work with IOS 8.0. This post I found online explains the changes to the LocationManager in IOS 8.x SDK quite well is http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/

               

              Workaround that we are using for now is, updating the initLocationManger method in <XcodeProjectPath>/Classes/GeoLocation/LocationController.m as below:

               

              - (void) initLocationManager:(NSObject*)param {

               

                  self._locationManager = [[[CLLocationManager alloc] init] autorelease];

                  self._locationManager.desiredAccuracy = kCLLocationAccuracyBest;

                  self._locationManager.delegate = self; // Tells the location manager to send updates to this object

               

                  // Workaround for IOS 8 SDK LocationManager changes

                  if ([self._locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {

                      [self._locationManager requestAlwaysAuthorization];

                  }

              }

               

              and updating Info.plist file with string values for NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription.

               

              A formal fix would be ideal, but I haven't seen if something like this has made into Rhodes GIT repo or Rho 5.x

              Would be great to hear if there are any other solutions / workarounds for this.

              1 of 1 people found this helpful
                • Re: Geo Location API not working on iOS 8 ?
                  Kutir Mobility

                  Hi b7e990a4-8efc-44f7-b104-5931e1f0dd0d

                  Have you tried Paul's suggestion and tried to solve your problem ?

                   

                  Thank you.

                  Visnupriya R

                  Kutir Mobility

                  • Re: Geo Location API not working on iOS 8 ?
                    Siddhant  Wadhera

                    Hi Paul

                     

                    Thanks for the answer i have been very busy lately but for sure i will give this a try

                     

                    Thanks

                    Siddhant

                    • Re: Geo Location API not working on iOS 8 ?
                      Vincent Lagneau

                      Hi Paul,

                       

                      My answer might be a little late, but it might help other people later struggling with GPS on iOS 8.

                       

                      First of all, thank you for this solution and the link to the post explaining the changes in the LocationManager for iOS 8. It helped me a lot.

                      It worked perfectly on rhodes 5.0.25 and an iPad mini running on iOS 8.1.3. After installing my app, on the first use, it asks me if it can use the GPS and if I accept the GPS works perfectly.

                       

                      But then, another problem appeared : after closing the app and restarting it, the GPS didn't work anymore on the application.

                       

                      So I dug a bit, and used the link you provided. The permission was okay for my app, as I accepted it on the first run. But still, the GPS wasn't working on my app after the first run and the acceptance of the use of the GPS.

                      So I took a look at the update function in the LocationController.m, the function called (bool)update. And I saw that the new authorization statuses used on IOS 8 weren't taken into account. So I simply added the status that I needed to be checked (in my case "kCLAuthorizationStatusAuthorizedWhenInUse") , and it works perfectly now. Here's how my update function looks like :

                       

                      - (bool)update{
                            @synchronized(self) {
                                if (!_locationManager)
                                    return false;
                                if (!_locationManager.locationServicesEnabled)
                                    return false;
                                if (![CLLocationManager locationServicesEnabled])
                                    return false;
                                if (([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) &&
                                    ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusNotDetermined) &&
                                    ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorizedWhenInUse) ) // Here's my fix
                                    return false;
                                isEnabled = YES;
                                _locationManager.delegate = self; // Tells the location manager to send updates to this object
                                if (_bMinDistanceMode) {
                                    _locationManager.distanceFilter = _dMinDistance;
                                    _locationManager.desiredAccuracy = _dMinDistance;
                                    [_locationManager startUpdatingLocation];
                                }
                                else {
                                    _locationManager.distanceFilter = kCLDistanceFilterNone;
                                    _locationManager.desiredAccuracy = kCLLocationAccuracyBest;
                                    [_locationManager startUpdatingLocation];
                                }
                            }
                            return true;
                        }
                      
                      
                      
                      
                      
                      
                      
                      
                      

                       

                      I hope this might help some other people having troubles with the GPS.

                       

                      Once again, thanks Paul.