diff --git a/CHANGELOG.md b/CHANGELOG.md index 118ace9..10f67b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +Version 3.3.0 - March 2020 +---------------- + * Add geofence and POI support + * Update IndoorAtlas SDKs to 3.3.3 + Version 3.2.1 - March 2020 ---------------- * Add geofence and POI support diff --git a/package.json b/package.json index c9ed322..b759599 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-indooratlas", - "version": "3.2.1", + "version": "3.3.0", "description": "Cordova plugin using IndoorAtlas SDK.", "cordova": { "id": "cordova-plugin-indooratlas", diff --git a/plugin.xml b/plugin.xml index fa66615..d976fe7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="3.3.0"> IndoorAtlas IndoorAtlas Cordova Plugin. diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloor.h b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloor.h index d1b047a..a2f9865 100644 --- a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloor.h +++ b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloor.h @@ -18,7 +18,7 @@ typedef double IACertainty; * It is a replacement for CoreLocation's CLFloor as the interface for that is not open. */ INDOORATLAS_API -@interface IAFloor : NSObject +@interface IAFloor : NSObject /** * Initializes and returns a floor object with the specified level information. diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloorPlan.h b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloorPlan.h index 118eac4..c157781 100644 --- a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloorPlan.h +++ b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IAFloorPlan.h @@ -11,7 +11,7 @@ * IAFloorPlan represents floor plan data received from service. */ INDOORATLAS_API -@interface IAFloorPlan : NSObject +@interface IAFloorPlan : NSObject /** * @name Floor plan information @@ -110,7 +110,7 @@ INDOORATLAS_API * @param coord WGS84 coordinate * @return corresponding pixel point on floor plan bitmap */ -- (CGPoint) coordinateToPoint:(CLLocationCoordinate2D) coord; +- (CGPoint)coordinateToPoint:(CLLocationCoordinate2D)coord; /** * Converts point to corresponding coordinate. @@ -118,32 +118,7 @@ INDOORATLAS_API * @param point pixel point of floor plan bitmap * @return corresponding WGS84 coordinate */ -- (CLLocationCoordinate2D) pointToCoordinate:(CGPoint) point; - -/** - * Initializes - * @param floorPlanId is the identifier of floor plan - * @param width is the width of the floor plan image in pixels - * @param height is the height of the floor plan image in pixels - * @param wgsToPixel is an NSArray of 6 double values in row major order used for creating an affine transform for point mapping - * @param pixelToWgs is an NSArray of 6 double values in row major order used for creating an affine transform for point mapping - */ -- (nullable id)initWithId:(nullable NSString *)floorPlanId width:(NSUInteger)width height:(NSUInteger)height wgs2pix:(nullable NSArray*)wgsToPixel pix2wgs:(nullable NSArray*)pixelToWgs; - -/** - * Initializes - * @param floorPlanId is the identifier of floor plan - * @param width is the width of the floor plan image in pixels - * @param height is the height of the floor plan image in pixels - * @param wgsToPixel is an NSArray of 6 double values in row major order used for creating an affine transform for point mapping - * @param pixelToWgs is an NSArray of 6 double values in row major order used for creating an affine transform for point mapping - * @param url is a NSURL object containing the url address of the floor plan image - * @param name is the name of the floor plan - * @param floor is a IAFloor object containing the floor number and floor certainty of the floor plan - */ -- (nullable id)initWithId:(nullable NSString *)floorPlanId width:(NSUInteger)width height:(NSUInteger)height wgs2pix:(nullable NSArray*)wgsToPixel pix2wgs:(nullable NSArray*)pixelToWgs - imageUrl:(nullable NSURL*)url name:(nullable NSString*)name - floor:(nullable IAFloor*) floor; +- (CLLocationCoordinate2D)pointToCoordinate:(CGPoint)point; @end diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IALocationManager.h b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IALocationManager.h index 1eabe08..cc46f12 100644 --- a/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IALocationManager.h +++ b/src/ios/IndoorAtlas/IndoorAtlas.framework/Headers/IALocationManager.h @@ -9,11 +9,14 @@ #define INDOORATLAS_API __attribute__((visibility("default"))) -// extraInfo dictionary keys +/** + * Use this key to obtain the session trace id from the [IALocationManager extraInfo](Classes/IALocationManager.html#/c:objc(cs)IALocationManager(py)extraInfo) dictionary. + */ INDOORATLAS_API extern NSString * _Nonnull const kIATraceId; @class IALocationManager; @class IAGeofence; +@class IAPOI; /** * Defines the type of region. @@ -92,32 +95,6 @@ typedef NS_ENUM(NSInteger, ia_location_accuracy) { kIALocationAccuracyBestForCart }; -/** - * Represents a point of interest. - */ -INDOORATLAS_API -@interface IAPOI : NSObject -/** - * Identifier of the point of interest - */ -@property (nonatomic, readonly, nonnull) NSString *identifier; -/** - * Name of the point of interest, can be empty - */ -@property (nonatomic, readonly, nullable) NSString *name; -/** - * The JSON payload for this point of interest. - */ -@property (nonatomic, readonly, nullable) NSDictionary *payload; -/** - * Location of the point of interest - */ -@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; -/** - * Floor the point of interest is located on. - */ -@property (nonatomic, readonly, nonnull) IAFloor *floor; -@end /** * Represents a venue in IndoorAtlas system @@ -127,15 +104,15 @@ INDOORATLAS_API /** * Name of the venue */ -@property (nonatomic, strong, nonnull) NSString *name; +@property (nonatomic, readonly, nonnull) NSString *name; /** * Mapped floors that the venue has */ -@property (nonatomic, strong, nonnull) NSArray *floorplans; +@property (nonatomic, readonly, nonnull) NSArray *floorplans; /** * ID of the venue in IndoorAtlas developer console */ -@property (nonatomic, strong, nonnull) NSString *id; +@property (nonatomic, readonly, nonnull) NSString *id; /** * Geofences for this venue */ @@ -180,29 +157,11 @@ INDOORATLAS_API @property (nonatomic, strong, nullable) IAFloorPlan *floorplan; @end -/** - * Struct defining bounding box in WGS84 coordinates. - */ -struct ia_bounding_box { - /** - * Coordinates for min and max corners of the bounding box. - */ - CLLocationCoordinate2D coords[2]; -}; - /** * An IAGeofence object provides a way to represent custom regions. */ INDOORATLAS_API @interface IAGeofence : IARegion -/** - * Bounding box of the geofence. - * - * The bounding box must accurately cover the hit testable area by method. - * - * The bounding box is used internally to optimize geofence lookups. - */ -@property (nonatomic, assign) struct ia_bounding_box boundingBox; /** * The floor the geofence is located on. */ @@ -211,10 +170,15 @@ INDOORATLAS_API * The JSON payload for this geofence. */ @property (nonatomic, strong, nullable) NSDictionary *payload; +/** + * Center coordinate of the geofence. + */ +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; /** * Is this geofence cloud defined (static) or runtime defined (dynamic) */ -@property (nonatomic) BOOL isCloudGeofence; +@property (nonatomic, readonly) BOOL isCloudGeofence; + /** * Does the geofence contain the coordinate? */ @@ -227,13 +191,13 @@ INDOORATLAS_API INDOORATLAS_API @interface IAPolygonGeofence : IAGeofence /** - * The unique points for the polygon. + * The unique points of the polygon. */ @property (nonatomic, readonly, strong) NSArray * _Nonnull points; /** * Creates a new polygonal region from unique edges. * @param identifier Identifier for the geofence. - * @param object with level information. Nil means that the floor is unknown. + * @param `IAFloor` object with level information. Nil `IAFloor` means that the floor is unknown. * @param edges Coordinates specifying the polygon. * * The edges must be supplied in clockwise order for the polygon to be valid. @@ -241,6 +205,17 @@ INDOORATLAS_API + (nonnull IAPolygonGeofence*)polygonGeofenceWithIdentifier:(nonnull NSString*)identifier andFloor:(nullable IAFloor*)floor edges:(nonnull NSArray*)edges; @end +/** + * Represents a point of interest. + */ +INDOORATLAS_API +@interface IAPOI : IAGeofence +/** + * The floor the POI is located on. + */ +@property (nonatomic, strong, nonnull) IAFloor *floor; +@end + /** * Provides wayfinding destination for the SDK. */ @@ -257,6 +232,9 @@ INDOORATLAS_API @property (nonatomic, assign) NSInteger floor; @end +/** + * Represents a point in a route. + */ INDOORATLAS_API @interface IARoutePoint : NSObject /** @@ -279,18 +257,18 @@ INDOORATLAS_API @end /** - * Object representing the line segment between two s. + * Object representing the line segment between two `IARoutePoint` objects. * Includes the distance and direction of the segment as well as the start and end points. */ INDOORATLAS_API @interface IARouteLeg : NSObject /** - * The representing the beginning of this leg. + * The `IARoutePoint` representing the beginning of this leg. */ @property (nonatomic, readonly, nonnull) IARoutePoint *begin; /** - * The representing the end of this leg. + * The `IARoutePoint` representing the end of this leg. */ @property (nonatomic, readonly, nonnull) IARoutePoint *end; @@ -320,29 +298,27 @@ INDOORATLAS_API INDOORATLAS_API @interface IARoute : NSObject /** - * An array of s connecting user's location to destination. + * An array of `IARouteLeg` objects connecting user's location to destination. */ @property (nonatomic, readonly, nonnull) NSArray *legs; @end /** - * specifies the current status of locationing service. + * IAStatus specifies the current status of the locationing service. */ INDOORATLAS_API @interface IAStatus : NSObject /** - * Type of status message. - * - * @param type See possible values at [ia_status_type](/Constants/ia_status_type.html) + * Type of the status message. */ @property (nonatomic, assign) enum ia_status_type type; @end /** - * An IALocation object represents the location data generated by an object. This object incorporates the geographical coordinates along with values indicating the accuracy of the measurements and when those measurements were made. + * An IALocation object represents the location data generated by an `IALocationManager` object. This object incorporates the geographical coordinates along with values indicating the accuracy of the measurements and when those measurements were made. * This class also reports information about the the course, the direction in which the device is traveling. * - * Typically, you use an object to create instances of this class based on the last known location of the user's device. + * Typically, you use an `IALocationManager` object to create instances of this class based on the last known location of the user's device. * You can create instances yourself, however, if you want to cache custom location data or get the distance between two points. * * This class is designed to be used as is and should not be subclassed. @@ -367,7 +343,7 @@ INDOORATLAS_API /** * Initializes and returns a location object with specified CoreLocation information. * @param location CLLocation object. Might be initialized in code or from CLLocationManager. - * @param object with level information. Nil means that the floor is unknown. + * @param `IAFloor` object with level information. Nil `IAFloor` means that the floor is unknown. * * An explicit location is used as a hint in the system. This means that the inputted location is used only to determine the initial position and setting the location does not lock the floor or venue context. */ @@ -380,7 +356,7 @@ INDOORATLAS_API /** * CoreLocation compatible [location information](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/). (read-only) * - * When running in the simulator, provides fake values. + * When running in the simulator, `IALocationManager` provides fake values. * You must run your application on an actual iOS device to get the actual location of the device. */ @property (nonatomic, readonly, nullable) CLLocation *location; @@ -395,24 +371,24 @@ INDOORATLAS_API * This property is included as CLLocation's CLFloor is private interface. * Thus it may be deprecated in future. */ -@property (nonatomic, readwrite, nullable) IAFloor *floor; +@property (nonatomic, strong, nullable) IAFloor *floor; /** * Region this location was obtained from. */ -@property (nonatomic, readwrite, nullable) IARegion *region; +@property (nonatomic, strong, nullable) IARegion *region; /** * Experimental feature for soft location updates. * The API may be changed in future. - * Set to true before giving as a custom location to to make the location behave more like radio source rather than a location hint. + * Set to true before giving as a custom location to `IALocationManager` to make the location behave more like radio source rather than a location hint. */ @property (nonatomic, assign) bool soft; @end /** - * Object containing heading data. Generated by + * Object containing heading data. Generated by `IALocationManager` */ INDOORATLAS_API @interface IAHeading : NSObject @@ -427,7 +403,7 @@ INDOORATLAS_API @end /** - * Object containing orientation data. Generated by + * Object containing orientation data. Generated by `IALocationManager` */ INDOORATLAS_API @interface IAAttitude : NSObject @@ -442,7 +418,7 @@ INDOORATLAS_API @end /** - * The IALocationManagerDelegate protocol defines the methods used to receive location updates from an object. + * The IALocationManagerDelegate protocol defines the methods used to receive location updates from an `IALocationManager` object. * * Upon receiving a successful location update, you can use the result to update your user interface or perform other actions. * @@ -462,7 +438,7 @@ INDOORATLAS_API * Implementation of this method is optional but recommended. * * @param manager The location manager object that generated the update event. - * @param locations An array of objects containing the location data. This array always contains at least one object representing the current location. + * @param locations An array of `IALocation` objects containing the location data. This array always contains at least one object representing the current location. * If updates were deferred or if multiple locations arrived before they could be delivered, the array may contain additional entries. * The objects in the array are organized in the order in which they occured. Threfore, the most recent location update is at the end of the array. */ @@ -490,7 +466,7 @@ INDOORATLAS_API - (void)indoorLocationManager:(nonnull IALocationManager*)manager didUpdateRoute:(nonnull IARoute*)route; /** - * Tells that status changed. This is used to signal network connection issues. + * Tells that `IALocationManager` status changed. This is used to signal network connection issues. * @param manager The location manager object that generated the event. * @param status The status at the time of the event. */ @@ -601,7 +577,7 @@ INDOORATLAS_API /** * The set of (dynamic) geofences monitored by the location manager. Note that automatically monitored cloud geofences are not included. * - * You cannot add geofences to this property directly. Instead use the method. + * You cannot add geofences to this property directly. Instead use the `[IALocationManager startMonitoringGeofence:]` method. */ @property(nonatomic, readonly, strong, nullable) NSArray *monitoredGeofences; @@ -632,11 +608,6 @@ INDOORATLAS_API */ + (nonnull NSString*)versionString; -/** - * Returns the shared instance. - */ -+ (nonnull IALocationManager *)sharedInstance; - /** * Locks positioning to specified floor level * @param floorNumber Floor level where the positioning is restricted @@ -676,10 +647,11 @@ INDOORATLAS_API * Starts the generation of updates that report the user's current location. * * This method returns immediately. Calling this method causes the location manager to obtain an initial location fix (which may take several seconds) - * and notify your delegate by calling its method. After that, the receiver generates update events whenever there is new estimate. + * and notify your delegate by calling its `[IALocationManagerDelegate indoorLocationManager:didUpdateLocations:]` method. After that, the receiver ` + * generates update events whenever there is new estimate. * * Calling this method several times in succession does not automatically result in new events being generated. - * Calling in-between, however, does cause a new initial event to be sent the next time you call this method. + * Calling `[IALocationManager stopUpdatingLocation]` in-between, however, does cause a new initial event to be sent the next time you call this method. * * If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (only in foreground). * If your app is terminated, the delivery of new location events stops altogether. @@ -735,10 +707,9 @@ INDOORATLAS_API - (void)stopMonitoringForWayfinding; /** - * Marks init method as deprecated. -* @deprecated + * Returns the shared instance. */ -- (_Nullable id)init __attribute__((deprecated("[[IALocationManager alloc] init] is depreated. Use [IALocationManager sharedInstance] instead."))); ++ (nonnull IALocationManager *)sharedInstance; @end #undef INDOORATLAS_API diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/IndoorAtlas b/src/ios/IndoorAtlas/IndoorAtlas.framework/IndoorAtlas index 55a07ce..2ac9f8c 100755 Binary files a/src/ios/IndoorAtlas/IndoorAtlas.framework/IndoorAtlas and b/src/ios/IndoorAtlas/IndoorAtlas.framework/IndoorAtlas differ diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/Info.plist b/src/ios/IndoorAtlas/IndoorAtlas.framework/Info.plist index 2d7c551..dacf756 100644 Binary files a/src/ios/IndoorAtlas/IndoorAtlas.framework/Info.plist and b/src/ios/IndoorAtlas/IndoorAtlas.framework/Info.plist differ diff --git a/src/ios/IndoorAtlas/IndoorAtlas.framework/Modules/module.modulemap b/src/ios/IndoorAtlas/IndoorAtlas.framework/Modules/module.modulemap index 17a1ca5..d975247 100644 --- a/src/ios/IndoorAtlas/IndoorAtlas.framework/Modules/module.modulemap +++ b/src/ios/IndoorAtlas/IndoorAtlas.framework/Modules/module.modulemap @@ -1,5 +1,7 @@ -framework module IndoorAtlas { umbrella header "IndoorAtlas.h" -header "IALocationManager.h" -header "IAFloorPlan.h" -header "IAFloor.h" -export * module * { export * } } \ No newline at end of file +framework module IndoorAtlas { + umbrella header "IndoorAtlas.h" + header "IALocationManager.h" + header "IAFloorPlan.h" + header "IAFloor.h" + export * module * { export * } +} diff --git a/src/ios/IndoorLocation.m b/src/ios/IndoorLocation.m index c162831..74ca7d7 100644 --- a/src/ios/IndoorLocation.m +++ b/src/ios/IndoorLocation.m @@ -70,82 +70,8 @@ - (void)pluginInitialize self.regionData = nil; } -- (BOOL)isAuthorized -{ - BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ - - if (authorizationStatusClassPropertyAvailable) { - NSUInteger authStatus = [CLLocationManager authorizationStatus]; -#ifdef __IPHONE_8_0 - if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { //iOS 8.0+ - return (authStatus == kCLAuthorizationStatusAuthorizedWhenInUse) || (authStatus == kCLAuthorizationStatusAuthorizedAlways) || (authStatus == kCLAuthorizationStatusNotDetermined); - } -#else - return (authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusNotDetermined); -#endif - - } - - // by default, assume YES (for iOS < 4.2) - return YES; -} - -- (BOOL)isLocationServicesEnabled -{ - BOOL locationServicesEnabledInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 3.x - BOOL locationServicesEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 4.x - - if (locationServicesEnabledClassPropertyAvailable) { // iOS 4.x - return [CLLocationManager locationServicesEnabled]; - } else if (locationServicesEnabledInstancePropertyAvailable) { // iOS 2.x, iOS 3.x - return [(id)self.locationManager locationServicesEnabled]; - - } else { - return NO; - } -} - - (void)startLocation { - if (![self isLocationServicesEnabled]) { - [self returnLocationError:PERMISSION_DENIED withMessage:@"Location services are not enabled."]; - return; - } - if (![self isAuthorized]) { - NSString *message = nil; - BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ - if (authStatusAvailable) { - NSUInteger code = [CLLocationManager authorizationStatus]; - if (code == kCLAuthorizationStatusNotDetermined) { - // could return POSITION_UNAVAILABLE but need to coordinate with other platforms - message = @"User undecided on application's use of location services."; - } else if (code == kCLAuthorizationStatusRestricted) { - message = @"Application's use of location services is restricted."; - } - else if(code == kCLAuthorizationStatusDenied) { - message = @"Application's use of location services is restricted."; - } - } - // PERMISSIONDENIED is only PositionError that makes sense when authorization denied - [self returnLocationError:PERMISSION_DENIED withMessage:message]; - - return; - } - -#ifdef __IPHONE_8_0 - NSUInteger code = [CLLocationManager authorizationStatus]; - if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)] || [self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])) { //iOS8+ - if([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]) { - [self.locationManager requestWhenInUseAuthorization]; - } else if([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]) { - [self.locationManager requestAlwaysAuthorization]; - } else { - NSLog(@"[Warning] No NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key is defined in the Info.plist file."); - } - return; - } -#endif - __locationStarted = YES; [self.IAlocationInfo startPositioning]; } @@ -162,10 +88,6 @@ - (void)_stopLocation } if (stopLocationservice) { if (__locationStarted) { - if (![self isLocationServicesEnabled]) { - return; - } - [self.locationManager stopUpdatingLocation]; __locationStarted = NO; } @@ -428,32 +350,24 @@ - (void)getLocation:(CDVInvokedUrlCommand *)command return; } - if ([self isLocationServicesEnabled] == NO) { - NSMutableDictionary *posError = [NSMutableDictionary dictionaryWithCapacity:2]; - [posError setObject:[NSNumber numberWithInt:PERMISSION_DENIED] forKey:@"code"]; - [posError setObject:@"Location services are disabled." forKey:@"message"]; - CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; - } else { - if (!self.locationData) { - self.locationData = [[IndoorLocationInfo alloc] init]; - } - IndoorLocationInfo *lData = self.locationData; - if (!lData.locationCallbacks) { - lData.locationCallbacks = [NSMutableArray arrayWithCapacity:1]; - } + if (!self.locationData) { + self.locationData = [[IndoorLocationInfo alloc] init]; + } + IndoorLocationInfo *lData = self.locationData; + if (!lData.locationCallbacks) { + lData.locationCallbacks = [NSMutableArray arrayWithCapacity:1]; + } - if (!__locationStarted || _locationData.region == nil) { - // add the callbackId into the array so we can call back when get data - if (callbackId != nil) { - [lData.locationCallbacks addObject:callbackId]; - } + if (!__locationStarted || _locationData.region == nil) { + // add the callbackId into the array so we can call back when get data + if (callbackId != nil) { + [lData.locationCallbacks addObject:callbackId]; + } - // Tell the location manager to start notifying us of heading updates - [self startLocation]; - } else { - [self returnLocationInfo:callbackId andKeepCallback:NO]; - } + // Tell the location manager to start notifying us of heading updates + [self startLocation]; + } else { + [self returnLocationInfo:callbackId andKeepCallback:NO]; } } @@ -482,17 +396,9 @@ - (void)addWatch:(CDVInvokedUrlCommand *)command // add the callbackId into the dictionary so we can call back whenever get data [lData.watchCallbacks setObject:callbackId forKey:timerId]; - if ([self isLocationServicesEnabled] == NO) { - NSMutableDictionary *posError = [NSMutableDictionary dictionaryWithCapacity:2]; - [posError setObject:[NSNumber numberWithInt:PERMISSION_DENIED] forKey:@"code"]; - [posError setObject:@"Location services are disabled." forKey:@"message"]; - CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; - } else { - if (!__locationStarted) { - // Tell the location manager to start notifying us of location updates - [self startLocation]; - } + if (!__locationStarted) { + // Tell the location manager to start notifying us of location updates + [self startLocation]; } } @@ -533,17 +439,9 @@ - (void)addRegionWatch:(CDVInvokedUrlCommand *)command // add the callbackId into the dictionary so we can call back whenever get data [lData.watchCallbacks setObject:callbackId forKey:timerId]; - if ([self isLocationServicesEnabled] == NO) { - NSMutableDictionary *posError = [NSMutableDictionary dictionaryWithCapacity:2]; - [posError setObject:[NSNumber numberWithInt:PERMISSION_DENIED] forKey:@"code"]; - [posError setObject:@"Location services are disabled." forKey:@"message"]; - CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; - } else { - if (!__locationStarted) { - // Tell the location manager to start notifying us of location updates - [self startLocation]; - } + if (!__locationStarted) { + // Tell the location manager to start notifying us of location updates + [self startLocation]; } }