Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Nov 24 16:43:41 my-iPhone locationd[64] <Notice>: client 'com.life360.safetymap' starting significant location changes
- - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
- {
- [LogPhoneEvent logPhoneEvent:@"APPLICATION DID FINISH LAUNCHING WITH OPTIONS"];
- [LocationManagement startSignificantChangeUpdates];
- CGRect screenBounds = [[UIScreen mainScreen] bounds];
- #if __has_feature(objc_arc)
- self.window = [[UIWindow alloc] initWithFrame:screenBounds];
- #else
- self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
- #endif
- self.window.autoresizesSubviews = YES;
- #if __has_feature(objc_arc)
- self.viewController = [[MainViewController alloc] init];
- #else
- self.viewController = [[[MainViewController alloc] init] autorelease];
- #endif
- // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml.
- // If necessary, uncomment the line below to override it.
- // self.viewController.startPage = @"index.html";
- self.window.rootViewController = self.viewController;
- [self.window makeKeyAndVisible];
- // NOTE: To customize the view's frame size (which defaults to full screen), override
- // [self.viewController viewWillAppear:] in your view controller.
- [self.viewController setLaunchOptions:launchOptions];
- // }
- return YES;
- }
- #import <CoreLocation/CoreLocation.h>
- #import "LogPhoneEvent.h"
- @interface LocationManagement : NSObject <CLLocationManagerDelegate>
- + (void)startSignificantChangeUpdates;
- + (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;
- + (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error;
- @end
- //
- // LocationManagement.m
- //
- #import "LocationManagement.h"
- @implementation LocationManagement
- CLLocationManager* locationManager;
- #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
- #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
- #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
- #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
- #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
- + (void)startSignificantChangeUpdates
- {
- // Create the location manager if this object does not
- // already have one.
- NSLog(@"LocationManagement attempting startSignificantChangeUpdates");
- if (nil == locationManager){
- locationManager = [[CLLocationManager alloc] init];
- [LogPhoneEvent logPhoneEvent:[NSString stringWithFormat:@"startSignificantChangeUpdates creating new CLLocationManager"]];
- }
- [locationManager setDelegate:(id)self];
- if ([CLLocationManager significantLocationChangeMonitoringAvailable]){
- NSLog(@"LocationManagement significantLocationChangeMonitoring IS AVAILABLE");
- if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0.0")){
- if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])
- {
- [locationManager requestAlwaysAuthorization];
- }
- }
- [LogPhoneEvent logPhoneEvent:[NSString stringWithFormat:@"startSignificantChangeUpdates START MONITORING SIGNIFICANT LOCATION CHANGES"]];
- [locationManager startMonitoringSignificantLocationChanges];
- //[locationManager startUpdatingLocation];
- NSLog(@"my-uBox LocationManagement starting significant change updates");
- }
- else{
- [LogPhoneEvent logPhoneEvent:[NSString stringWithFormat:@"startSignificantChangeUpdates significantLocationChangeMonitoring NOT AVAILABLE"]];
- NSLog(@"my-uBox LocationManagement significantLocationChangeMonitoring NOT AVAILABLE");
- }
- }
- +(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
- CLLocation *newLocation = [locations lastObject];
- [LogPhoneEvent logPhoneEvent:[NSString stringWithFormat:@"locationmanager DID UPDATE LOCATION to %@", newLocation]];
- NSLog(@"LocationManagement didUpdateLocations to %@", newLocation);
- }
- +(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
- NSLog(@"LocationManagement didFailWithError %@", error);
- [LogPhoneEvent logPhoneEvent:[NSString stringWithFormat:@"locationmanager DID FAIL WITH ERROR %@", error]];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement