GeoFake

Simulate Location,Motion and Beacon information for Debugging iOS apps

48
7
Objective-C

GeoFake.framework

Simulate Location and Motion information for Debugging iOS apps. GeoFake framework works with GeoPlayer.

GeoPlayer@GitHub: https://github.com/AlohaYos/GeoPlayer

debug_desk

If you ever build your iOS app using GPS, you probably experienced the difficulty of debugging it on the desk.

Unless testing your app in outdoor field, you can not realize unstable behavior of GPS, Cell-tower and WiFi.

Your fitness app draw your running route on the map exactly ?

Your travel app get correct information while you are walking around ?

These apps need moving-around-test in outdoor many times.

For such case, iOS simulator has location-simulation debug feature.
But that simulation is not good enouth, because it is NOT using real information.

DiamondheadRun

Playback real GPS movement

GPS signal jumps from entrance to exit of tunnel, for example.
GeoPlayer can record such unusual behaviors and can playback them.
These recording data will be very important debug resource for your job on the desk.

connect_iphones

Playback GPX data

GeoPlayer playbacks GPX data and playback speed is same as recording speed.
If you have marathon data of three-hour-finisher in iPhone(A), you can playback it in three hours and send location information of each second to iPhone(B) via Bluetooth.

iPhone(B) receives that location information and act as if running that marathon right now. You can debug your GPS app in iPhone(B) using information from iPhone(A) like this.

Playback motion data

Also GeoPlayer can send motion information to iPhone(B). When using iPhone with M7 processor, GeoPlayer can record location and motion data at the same time. Motion data are activities like walking, running or stopping.

debug_code

Geo fence debugging

Using GeoPlayer and GeoFake framework, you can test your GeoFence app on the desk.

Precise simulation in manual mode

GeoPlayer has manual operation mode. When you move GeoPlayer's map with your finger, the map of iPhone(B) will follow your finger movement. So, you can simulate location precisely while debugging.


How to debug your GPS/Motion app with GeoFake.framework

Video tutorial available here.

  1. add Framework

    GeoFake.framework

  2. import header file

    #import <GeoFake/GeoFake.h>

  3. initialize location update

    #ifdef GEO_FAKE
    [[GeoFake sharedFake] setLocationManager:_locationManager mapView:_mapView];
    [[GeoFake sharedFake] startUpdatingLocation];
    [[GeoFake sharedFake] startUpdatingHeading];
    #else
    [_locationManager startUpdatingLocation];
    [_locationManager startUpdatingHeading];
    #endif

  4. initialize motion update (if needed)

    void (^motionHandler)(CMMotionActivity *activity) = ^void(CMMotionActivity *activity){
    _motionActivity = activity; // whatever you need to do
    };

       if([CMMotionActivityManager isActivityAvailable]) {
    

    #ifdef GEO_FAKE
    [[GeoFake sharedFake] startActivityUpdatesWithHandler:motionHandler];
    #else
    _activityManager = [[CMMotionActivityManager alloc]init];
    [_activityManager startActivityUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:motionHandler];
    #endif
    }

  5. set link flag at “Build Settings”

    Linking
    Other Linker Flags “-ObjC -all_load”

  6. build and run !


How to connect with GeoPlayer

Please visit this website.


GeoFake Class Interface

@interface GeoFake : NSObject
// Shared instance + (GeoFake *)sharedFake; // Fake CoreLocation (Location update) - (void)setLocationManager:(CLLocationManager*)locMan mapView:(MKMapView*)mapView; - (void)startUpdatingLocation; - (void)stopUpdatingLocation; - (void)startUpdatingHeading; - (void)stopUpdatingHeading; // Fake CoreLocation (Region monitoring) - (void)startMonitoringForRegion:(CLRegion *)region; - (void)stopMonitoringForRegion:(CLRegion *)region; - (NSSet*)monitoredRegions; - (void)requestStateForRegion:(CLRegion *)region; // Fake CoreMotion (Motion activity) - (void)startActivityUpdatesWithHandler:(CMMotionActivityHandler)handler; - (void)stopActivityUpdates; @end