27
27
#import " INTULocationRequest.h"
28
28
29
29
30
+ #ifndef INTU_ENABLE_LOGGING
31
+ #ifdef DEBUG
32
+ #define INTU_ENABLE_LOGGING 1
33
+ #else
34
+ #define INTU_ENABLE_LOGGING 0
35
+ #endif /* DEBUG */
36
+ #endif /* INTU_ENABLE_LOGGING */
37
+
38
+ #if INTU_ENABLE_LOGGING
39
+ #define INTULMLog (...) NSLog (@" INTULocationManager: %@ " , [NSString stringWithFormat: __VA_ARGS__]);
40
+ #else
41
+ #define INTULMLog (...)
42
+ #endif /* INTU_ENABLE_LOGGING */
43
+
44
+
30
45
@interface INTULocationManager () <CLLocationManagerDelegate, INTULocationRequestDelegate>
31
46
32
47
// The instance of CLLocationManager encapsulated by this class.
@@ -145,7 +160,7 @@ - (void)cancelLocationRequest:(NSInteger)requestID
145
160
}
146
161
[self .locationRequests removeObject: locationRequestToCancel];
147
162
[locationRequestToCancel cancelLocationRequest ];
148
- NSLog (@" INTULocationManager: Location Request cancelled with ID: %ld " , (long )locationRequestToCancel.requestID );
163
+ INTULMLog (@" Location Request cancelled with ID: %ld " , (long )locationRequestToCancel.requestID );
149
164
[self stopUpdatingLocationIfPossible ];
150
165
}
151
166
@@ -165,7 +180,7 @@ - (void)addLocationRequest:(INTULocationRequest *)locationRequest
165
180
166
181
[self startUpdatingLocationIfNeeded ];
167
182
[self .locationRequests addObject: locationRequest];
168
- NSLog (@" INTULocationManager: Location Request added with ID: %ld " , (long )locationRequest.requestID );
183
+ INTULMLog (@" Location Request added with ID: %ld " , (long )locationRequest.requestID );
169
184
}
170
185
171
186
/* *
@@ -197,7 +212,7 @@ - (void)startUpdatingLocationIfNeeded
197
212
self.locationManager .desiredAccuracy = kCLLocationAccuracyBest ;
198
213
[self .locationManager startUpdatingLocation ];
199
214
if (self.isUpdatingLocation == NO ) {
200
- NSLog (@" INTULocationManager: Location services started." );
215
+ INTULMLog (@" Location services started." );
201
216
}
202
217
self.isUpdatingLocation = YES ;
203
218
}
@@ -212,7 +227,7 @@ - (void)stopUpdatingLocationIfPossible
212
227
if ([self .locationRequests count ] == 0 ) {
213
228
[self .locationManager stopUpdatingLocation ];
214
229
if (self.isUpdatingLocation ) {
215
- NSLog (@" INTULocationManager: Location services stopped." );
230
+ INTULMLog (@" Location services stopped." );
216
231
}
217
232
self.isUpdatingLocation = NO ;
218
233
}
@@ -267,7 +282,7 @@ - (void)completeAllLocationRequests
267
282
for (INTULocationRequest *locationRequest in locationRequests) {
268
283
[self completeLocationRequest: locationRequest];
269
284
}
270
- NSLog (@" INTULocationManager: Finished completing all location requests." );
285
+ INTULMLog (@" Finished completing all location requests." );
271
286
}
272
287
273
288
/* *
@@ -291,7 +306,7 @@ - (void)completeLocationRequest:(INTULocationRequest *)locationRequest
291
306
if (locationRequest.block ) {
292
307
locationRequest.block (currentLocation, achievedAccuracy, status);
293
308
}
294
- NSLog (@" INTULocationManager: Location Request completed with ID: %ld , currentLocation: %@ , achievedAccuracy: %lu , status: %lu " , (long )locationRequest.requestID , currentLocation, (unsigned long ) achievedAccuracy, (unsigned long )status);
309
+ INTULMLog (@" Location Request completed with ID: %ld , currentLocation: %@ , achievedAccuracy: %lu , status: %lu " , (long )locationRequest.requestID , currentLocation, (unsigned long ) achievedAccuracy, (unsigned long )status);
295
310
}
296
311
297
312
/* *
@@ -389,7 +404,7 @@ - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray
389
404
390
405
- (void )locationManager : (CLLocationManager *)manager didFailWithError : (NSError *)error
391
406
{
392
- NSLog (@" INTULocationManager: Location update error: %@ " , [error localizedDescription ]);
407
+ INTULMLog (@" Location update error: %@ " , [error localizedDescription ]);
393
408
self.updateFailed = YES ;
394
409
395
410
[self completeAllLocationRequests ];
0 commit comments