Skip to content

Commit

Permalink
[FENCE-1981] fix reverseGeocode signature (#345)
Browse files Browse the repository at this point in the history
* fix reverseGeocode signature

* bump version

* update example reverse geocode
  • Loading branch information
ShiCheng-Lu authored May 31, 2024
1 parent 737adce commit 700d565
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
Radar.reverseGeocode { (status, addresses) in
print("Reverse geocode: status = \(Radar.stringForStatus(status)); formattedAddress = \(String(describing: addresses?.first?.formattedAddress))")
}

Radar.reverseGeocode(layers: ["locality", "state"]) { (status, addresses) in
print("Reverse geocode: status = \(Radar.stringForStatus(status)); formattedAddress = \(String(describing: addresses?.first?.formattedAddress))")
}

Radar.reverseGeocode(location: CLLocation(latitude: 40.70390, longitude: -73.98670)) { (status, addresses) in
print("Reverse geocode: status = \(Radar.stringForStatus(status)); formattedAddress = \(String(describing: addresses?.first?.formattedAddress))")
}

Radar.reverseGeocode(location: CLLocation(latitude: 40.70390, longitude: -73.98670), layers: ["locality", "state"]) { (status, addresses) in
print("Reverse geocode: status = \(Radar.stringForStatus(status)); formattedAddress = \(String(describing: addresses?.first?.formattedAddress))")
}

Radar.ipGeocode { (status, address, proxy) in
print("IP geocode: status = \(Radar.stringForStatus(status)); country = \(String(describing: address?.countryCode)); city = \(String(describing: address?.city)); proxy = \(proxy)")
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.11.1'
s.version = '3.11.2'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => '[email protected]' }
Expand Down
4 changes: 2 additions & 2 deletions RadarSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.11.1;
MARKETING_VERSION = 3.11.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1051,7 +1051,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.11.1;
MARKETING_VERSION = 3.11.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = "-fembed-bitcode";
Expand Down
13 changes: 12 additions & 1 deletion RadarSDK/Include/Radar.h
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,17 @@ Gets the device's current location, then searches for geofences near that locati
*/
+ (void)reverseGeocodeWithCompletionHandler:(RadarGeocodeCompletionHandler)completionHandler NS_SWIFT_NAME(reverseGeocode(completionHandler:));

/**
Gets the device's current location, then reverse geocodes that location, converting coordinates to address.
@param completionHandler A completion handler.
@param layers Optional layer filters.
@see https://radar.com/documentation/api#reverse-geocode
*/
+ (void)reverseGeocodeWithLayers:(NSArray<NSString *> *_Nullable)layers
completionHandler:(RadarGeocodeCompletionHandler)completionHandler NS_SWIFT_NAME(reverseGeocode(layers:completionHandler:));

/**
Reverse geocodes a location, converting coordinates to address.
Expand All @@ -1007,7 +1018,7 @@ Gets the device's current location, then searches for geofences near that locati
@see https://radar.com/documentation/api#reverse-geocode
*/
+ (void)reverseGeocodeLocation:(CLLocation *)location
layers:(NSString *_Nullable)layers
layers:(NSArray<NSString *> *_Nullable)layers
completionHandler:(RadarGeocodeCompletionHandler)completionHandler NS_SWIFT_NAME(reverseGeocode(location:layers:completionHandler:));

/**
Expand Down
7 changes: 6 additions & 1 deletion RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,11 @@ + (void)geocodeAddress:(NSString *)query completionHandler:(RadarGeocodeCompleti
}

+ (void)reverseGeocodeWithCompletionHandler:(RadarGeocodeCompletionHandler)completionHandler {
[Radar reverseGeocodeWithLayers:nil completionHandler:completionHandler];
}

+ (void)reverseGeocodeWithLayers:(NSArray<NSString *> *_Nullable)layers
completionHandler:(RadarGeocodeCompletionHandler)completionHandler {
[[RadarLocationManager sharedInstance] getLocationWithCompletionHandler:^(RadarStatus status, CLLocation *_Nullable location, BOOL stopped) {
if (status != RadarStatusSuccess) {
if (completionHandler) {
Expand All @@ -875,7 +880,7 @@ + (void)reverseGeocodeWithCompletionHandler:(RadarGeocodeCompletionHandler)compl

return;
}
[Radar reverseGeocodeLocation:location layers:nil completionHandler:completionHandler];
[Radar reverseGeocodeLocation:location layers:layers completionHandler:completionHandler];
}];
}

Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ + (NSNumber *)timeZoneOffset {
}

+ (NSString *)sdkVersion {
return @"3.11.1";
return @"3.11.2";
}

+ (NSString *)deviceId {
Expand Down

0 comments on commit 700d565

Please sign in to comment.