summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-12-02 13:33:11 -0800
committerJustin R. Miller <incanus@codesorcery.net>2015-12-03 11:12:15 -0800
commite2921f7e7c9d86d6abdca41443dd79bd0089a74e (patch)
treebd4fdf051590f245f593465e0246f9bbaa5f1ce9
parentdbe68760ec32938fcab408082345eadfbcf88b9b (diff)
downloadqtlocation-mapboxgl-e2921f7e7c9d86d6abdca41443dd79bd0089a74e.tar.gz
refs #3112: cleanups around Core Telephony runtime
- don't do anything with CT in simulator - more direct use of dynamic selectors for clarity
-rw-r--r--platform/ios/MGLMapboxEvents.m13
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index a0f87eeabe..239ac7ece2 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -76,21 +76,22 @@ const NSTimeInterval MGLFlushInterval = 60;
_scale = [UIScreen mainScreen].scale;
}
+#if !TARGET_OS_SIMULATOR
// Collect cellular carrier data if CoreTelephony is linked
- Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo");
- if (CTTelephonyNetworkInfo != NULL) {
- id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init];
-
+ Class MGLTelephony = NSClassFromString(@"CTTelephonyNetworkInfo");
+ if (MGLTelephony) {
+ id telephonyNetworkInfo = [[MGLTelephony alloc] init];
SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider");
- id carrierVendor = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:subscriberCellularProviderSelector])(telephonyNetworkInfo, subscriberCellularProviderSelector);
+ id carrierVendor = [telephonyNetworkInfo performSelector:subscriberCellularProviderSelector];
// Guard against simulator, iPod Touch, etc.
if (carrierVendor) {
SEL carrierNameSelector = NSSelectorFromString(@"carrierName");
- NSString *carrierName = ((id (*)(id, SEL))[carrierVendor methodForSelector:carrierNameSelector])(carrierVendor, carrierNameSelector);
+ NSString *carrierName = [carrierVendor performSelector:carrierNameSelector];
_carrier = carrierName;
}
}
+#endif
}
return self;
}