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

Commit e5f136a

Browse files
committed
[ios] fix CoreTelephony crash (by removing it)
Fix #3112, ref #2581
1 parent 43ca910 commit e5f136a

File tree

3 files changed

+1
-46
lines changed

3 files changed

+1
-46
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Known issues:
2323

2424
## iOS master
2525

26+
- Fixed CoreTelephony.framework crash. ([#3170](https://github.com/mapbox/mapbox-gl-native/pull/3170))
2627
- `MGLMapView` methods that alter the viewport now accept optional completion handlers. ([#3090](https://github.com/mapbox/mapbox-gl-native/pull/3090))
2728
- 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))
2829

docs/BUILD_IOS_OSX.md

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ Currently, until [#1437](https://github.com/mapbox/mapbox-gl-native/issues/1437)
8383
- `libc++.dylib`
8484
- `libsqlite3.dylib`
8585
- `libz.dylib`
86-
- `CoreTelephony.framework` (optional, telemetry-only)
8786
8887
1. Add `-ObjC` to your target's "Other Linker Flags" build setting (`OTHER_LDFLAGS`).
8988

platform/ios/MGLMapboxEvents.m

-45
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,6 @@ - (instancetype)init {
7575
} else {
7676
_scale = [UIScreen mainScreen].scale;
7777
}
78-
79-
#if !TARGET_OS_SIMULATOR
80-
// Collect cellular carrier data if CoreTelephony is linked
81-
Class MGLTelephony = NSClassFromString(@"CTTelephonyNetworkInfo");
82-
if (MGLTelephony) {
83-
id telephonyNetworkInfo = [[MGLTelephony alloc] init];
84-
SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider");
85-
id carrierVendor = [telephonyNetworkInfo performSelector:subscriberCellularProviderSelector];
86-
87-
// Guard against simulator, iPod Touch, etc.
88-
if (carrierVendor) {
89-
SEL carrierNameSelector = NSSelectorFromString(@"carrierName");
90-
NSString *carrierName = [carrierVendor performSelector:carrierNameSelector];
91-
_carrier = carrierName;
92-
}
93-
}
94-
#endif
9578
}
9679
return self;
9780
}
@@ -510,13 +493,6 @@ - (void) pushEvent:(NSString *)event withAttributes:(MGLMapboxEventAttributes *)
510493
[evt setValue:@((int)(100 * [UIDevice currentDevice].batteryLevel)) forKey:@"batteryLevel"];
511494
[evt setValue:@(strongSelf.data.scale) forKey:@"resolution"];
512495

513-
if (strongSelf.data.carrier) {
514-
[evt setValue:strongSelf.data.carrier forKey:@"carrier"];
515-
516-
NSString *cell = [strongSelf currentCellularNetworkConnectionType];
517-
[evt setObject:(cell ? cell : [NSNull null]) forKey:@"cellularNetworkType"];
518-
}
519-
520496
MGLReachability *reachability = [MGLReachability reachabilityForLocalWiFi];
521497
[evt setValue:([reachability isReachableViaWiFi] ? @YES : @NO) forKey:@"wifi"];
522498

@@ -725,27 +701,6 @@ - (NSInteger) contentSizeScale {
725701
return result;
726702
}
727703

728-
// Can be called from any thread.
729-
//
730-
- (NSString *) currentCellularNetworkConnectionType {
731-
NSString *radioTech;
732-
733-
Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
734-
if (CTTelephonyNetworkInfo) {
735-
id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];
736-
SEL currentRadioAccessTechnologySelector = NSSelectorFromString(@"currentRadioAccessTechnology");
737-
radioTech = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:currentRadioAccessTechnologySelector])(telephonyNetworkInfo, currentRadioAccessTechnologySelector);
738-
}
739-
740-
if (radioTech == nil) {
741-
return nil;
742-
} else if ([radioTech hasPrefix:@"CTRadioAccessTechnology"]) {
743-
return [radioTech substringFromIndex:23];
744-
} else {
745-
return @"Unknown";
746-
}
747-
}
748-
749704
// Can be called from any thread.
750705
//
751706
+ (BOOL) checkPushEnabled {

0 commit comments

Comments
 (0)