Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] fix CoreTelephony crash (by removing it)
Browse files Browse the repository at this point in the history
Fix #3112, ref #2581
  • Loading branch information
friedbunny authored and incanus committed Dec 3, 2015
1 parent e2921f7 commit f67ceec
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 46 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Known issues:

## iOS master

- Fixed CoreTelephony.framework crash. ([#3170](https://github.com/mapbox/mapbox-gl-native/pull/3170))
- `MGLMapView` methods that alter the viewport now accept optional completion handlers. ([#3090](https://github.com/mapbox/mapbox-gl-native/pull/3090))
- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3117](https://github.com/mapbox/mapbox-gl-native/pull/3117))

## iOS 3.0.0
Expand Down
1 change: 0 additions & 1 deletion docs/BUILD_IOS_OSX.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ Currently, until [#1437](https://github.com/mapbox/mapbox-gl-native/issues/1437)
- `libc++.dylib`
- `libsqlite3.dylib`
- `libz.dylib`
- `CoreTelephony.framework` (optional, telemetry-only)
1. Add `-ObjC` to your target's "Other Linker Flags" build setting (`OTHER_LDFLAGS`).
Expand Down
45 changes: 0 additions & 45 deletions platform/ios/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,6 @@ - (instancetype)init {
} else {
_scale = [UIScreen mainScreen].scale;
}

#if !TARGET_OS_SIMULATOR
// Collect cellular carrier data if CoreTelephony is linked
Class MGLTelephony = NSClassFromString(@"CTTelephonyNetworkInfo");
if (MGLTelephony) {
id telephonyNetworkInfo = [[MGLTelephony alloc] init];
SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider");
id carrierVendor = [telephonyNetworkInfo performSelector:subscriberCellularProviderSelector];

// Guard against simulator, iPod Touch, etc.
if (carrierVendor) {
SEL carrierNameSelector = NSSelectorFromString(@"carrierName");
NSString *carrierName = [carrierVendor performSelector:carrierNameSelector];
_carrier = carrierName;
}
}
#endif
}
return self;
}
Expand Down Expand Up @@ -510,13 +493,6 @@ - (void) pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)
[evt setValue:@((int)(100 * [UIDevice currentDevice].batteryLevel)) forKey:@"batteryLevel"];
[evt setValue:@(strongSelf.data.scale) forKey:@"resolution"];

if (strongSelf.data.carrier) {
[evt setValue:strongSelf.data.carrier forKey:@"carrier"];

NSString *cell = [strongSelf currentCellularNetworkConnectionType];
[evt setObject:(cell ? cell : [NSNull null]) forKey:@"cellularNetworkType"];
}

MGLReachability *reachability = [MGLReachability reachabilityForLocalWiFi];
[evt setValue:([reachability isReachableViaWiFi] ? @YES : @NO) forKey:@"wifi"];

Expand Down Expand Up @@ -725,27 +701,6 @@ - (NSInteger) contentSizeScale {
return result;
}

// Can be called from any thread.
//
- (NSString *) currentCellularNetworkConnectionType {
NSString *radioTech;

Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
if (CTTelephonyNetworkInfo) {
id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];
SEL currentRadioAccessTechnologySelector = NSSelectorFromString(@"currentRadioAccessTechnology");
radioTech = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:currentRadioAccessTechnologySelector])(telephonyNetworkInfo, currentRadioAccessTechnologySelector);
}

if (radioTech == nil) {
return nil;
} else if ([radioTech hasPrefix:@"CTRadioAccessTechnology"]) {
return [radioTech substringFromIndex:23];
} else {
return @"Unknown";
}
}

// Can be called from any thread.
//
+ (BOOL) checkPushEnabled {
Expand Down

0 comments on commit f67ceec

Please sign in to comment.