Skip to content

Commit 3dd3b1a

Browse files
author
Ali Sarrafi
committed
Merge pull request MoSync#478 from mvasiliniuc/ThreeThree_GPS
Requesting merge for MOSYNC-3238
2 parents dc0260b + 8e4db4d commit 3dd3b1a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

runtimes/cpp/platforms/iphone/Classes/Location/MoSyncLocation.mm

+12-6
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,23 @@
2929
return sLocationController;
3030
}
3131

32+
// TODO Redo this so that it returns true availability
33+
// (depending on the users accept of sharing locaation).
3234
int maLocationStart()
3335
{
34-
MoSyncCLController* locationController = getLocationController();
35-
[locationController.locationManager startUpdatingLocation];
36+
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
37+
MoSyncCLController* locationController = getLocationController();
38+
[locationController.locationManager startUpdatingLocation];
39+
}];
3640
return MA_LPS_AVAILABLE;
3741
}
3842

3943
int maLocationStop()
4044
{
41-
MoSyncCLController* locationController = getLocationController();
42-
[locationController.locationManager stopUpdatingLocation];
45+
[[NSOperationQueue mainQueue] addOperationWithBlock:^ {
46+
MoSyncCLController* locationController = getLocationController();
47+
[locationController.locationManager stopUpdatingLocation];
48+
}];
4349
return 0;
4450
}
4551

@@ -50,8 +56,8 @@ @implementation MoSyncCLController
5056
- (id) init {
5157
self = [super init];
5258
if (self != nil) {
53-
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
54-
self.locationManager.delegate = self; // send loc updates to myself
59+
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
60+
[self.locationManager setDelegate:self];
5561
}
5662
return self;
5763
}

0 commit comments

Comments
 (0)