summaryrefslogtreecommitdiff
path: root/platform
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-02 13:33:37 -0800
commit43ca910f5484c15830a0fc24164df1799a17b6ca (patch)
treeac48cd784b99a53a6e7bc0c8ab3d7028b135b8bb /platform
parent2a0d2b7f0bb655607f4104b1d22b23d4cd1d6e2b (diff)
downloadqtlocation-mapboxgl-43ca910f5484c15830a0fc24164df1799a17b6ca.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
Diffstat (limited to 'platform')
-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;
}