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

Commit

Permalink
[ios] Fix for a crash on iPod Touch related to carrier vendor
Browse files Browse the repository at this point in the history
Reverts #2691, which only fixed simulator crashing.

Refs #2687
  • Loading branch information
adam-mapbox authored and friedbunny committed Oct 22, 2015
1 parent 4f50928 commit 6a0374f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions platform/ios/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ - (instancetype)init {
_scale = [UIScreen mainScreen].scale;
}

#if (!TARGET_IPHONE_SIMULATOR)
// Collect cellular carrier data if CoreTelephony is linked
Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
if (CTTelephonyNetworkInfo != NULL) {
Expand All @@ -85,11 +84,13 @@ - (instancetype)init {
SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider");
id carrierVendor = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:subscriberCellularProviderSelector])(telephonyNetworkInfo, subscriberCellularProviderSelector);

SEL carrierNameSelector = NSSelectorFromString(@"carrierName");
NSString *carrierName = ((id (*)(id, SEL))[carrierVendor methodForSelector:carrierNameSelector])(carrierVendor, carrierNameSelector);
_carrier = carrierName;
// Guard against simulator, iPod Touch, etc.
if (carrierVendor) {
SEL carrierNameSelector = NSSelectorFromString(@"carrierName");
NSString *carrierName = ((id (*)(id, SEL))[carrierVendor methodForSelector:carrierNameSelector])(carrierVendor, carrierNameSelector);
_carrier = carrierName;
}
}
#endif
}
return self;
}
Expand Down

0 comments on commit 6a0374f

Please sign in to comment.