How to solve Xcode 4.1 (LION) GPS error?

后端 未结 4 423
长情又很酷
长情又很酷 2020-12-12 19:17

My project worked perfectly on simulator+device,
but now, after upgrading to lion os and xcode 4.1, I get this error when gps is active

相关标签:
4条回答
  • 2020-12-12 19:27

    Xcode 4.2 solved this problem adding custom gps position!

    The file is an XML like this:

    <?xml version="1.0"?>
    <gpx version="1.1" creator="Xcode"> 
      <wpt lat="45,49939" lon="9,12114">
        <name>Milano</name>
      </wpt>
    </gpx>
    

    you can add this file in your project or New->File->GPX.

    While you're running your app, activate the console and select your custom position file:

    enter image description here

    it's all.
    enjoy.

    0 讨论(0)
  • 2020-12-12 19:28

    From the Big Nerd Ranch forum:

    @implementation CLLocationManager (TemporaryHack)
    - (void)hackLocationFix {
        CLLocation *location = [[CLLocation alloc] initWithLatitude:42 longitude:-50];
        [[self delegate] locationManager:self didUpdateToLocation:location fromLocation:nil];     
    }
    - (void)hackHeadingFix {
        [[self delegate] locationManager:self didUpdateHeading:(id)@"That way.."];
    }
    - (void)startUpdatingLocation {
        [self performSelector:@selector(hackLocationFix) withObject:nil afterDelay:0.1];
    }
    - (void)startUpdatingHeading {
        [self performSelector:@selector(hackHeadingFix) withObject:nil afterDelay:0.1];
    }
    @end
    
    0 讨论(0)
  • 2020-12-12 19:32

    I encountered the same problem, and searching for a solution, I at least found a workaround: Testing CoreLocation on iPhone Simulator - It doesn't actually make it work, but in my case I just needed a dummy location anyway.

    To make it work, just copy linked code into a header file and link that below your

    #import <CoreLocation/CoreLocation.h>
    

    Like this:

    #import <CoreLocation/CoreLocation.h>
    #import "CoreLocation_Sim.h" 
    
    0 讨论(0)
  • 2020-12-12 19:39

    Please see http://pastebin.com/7hvFiXCg for a somewhat souped-up version of the BNR code. It includes CLHeading support, among other adjustments. Enjoy!

    0 讨论(0)
提交回复
热议问题