Commit 1ecee92b authored by Bosko Petreski's avatar Bosko Petreski Committed by Bosko Petreski

location fix timer

parent 525be067
......@@ -18,6 +18,11 @@
@implementation PIOViewControllerDemo_PrimedTracker
-(void)trackLocation{
PIOAppDelegate *appDelegate = (PIOAppDelegate *)[[UIApplication sharedApplication] delegate];
[PrimedTracker.sharedInstance trackPositionChange:appDelegate.locationManager.location];
}
#pragma mark - IBActions
-(IBAction)onBtnTrackView:(UIButton *)sender{
// [PrimedTracker.sharedInstance trackView:@"Test View Example"];
......@@ -64,10 +69,17 @@
// Create PrimedTracker instance
[PrimedTracker.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"http://url.here" trackingConnectionString:@"http://url.here" heartbeatInterval:10 eventQueueRetryInterval:10];
[NSTimer scheduledTimerWithTimeInterval:10 repeats:YES block:^(NSTimer * _Nonnull timer) {
PIOAppDelegate *appDelegate = (PIOAppDelegate *)[[UIApplication sharedApplication] delegate];
[PrimedTracker.sharedInstance trackPositionChange:appDelegate.locationManager.location];
}];
if (@available(iOS 10.0, *)) {
[NSTimer scheduledTimerWithTimeInterval:10 repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackLocation];
}];
} else {
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(trackLocation) userInfo:nil repeats:YES];
}
}
-(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment