Skip to content

Commit

Permalink
[ios] fix simulator crash on optional CoreTelephony code
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Oct 21, 2015
1 parent bd917b2 commit 627cc25
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion platform/ios/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ - (instancetype)init {
_scale = [UIScreen mainScreen].scale;
}

#if (!TARGET_IPHONE_SIMULATOR)
// Collect cellular carrier data if CoreTelephony is linked
Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
if (CTTelephonyNetworkInfo) {
if (CTTelephonyNetworkInfo != NULL) {
id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];

SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider");
Expand All @@ -88,6 +89,7 @@ - (instancetype)init {
NSString *carrierName = ((id (*)(id, SEL))[carrierVendor methodForSelector:carrierNameSelector])(carrierVendor, carrierNameSelector);
_carrier = carrierName;
}
#endif
}
return self;
}
Expand Down

0 comments on commit 627cc25

Please sign in to comment.