{"id":149,"date":"2014-12-10T16:34:11","date_gmt":"2014-12-10T08:34:11","guid":{"rendered":"http:\/\/www.olinone.com\/?p=149"},"modified":"2015-12-01T14:58:33","modified_gmt":"2015-12-01T06:58:33","slug":"ios%e5%bc%80%e5%8f%91%e4%b8%ad%e5%a6%82%e4%bd%95%e6%a3%80%e6%b5%8b%e5%bd%93%e5%89%8d%e8%bf%90%e8%a1%8c%e5%95%86%e7%b1%bb%e5%9e%8b%e7%a7%bb%e5%8a%a8%e3%80%81%e8%81%94%e9%80%9a%e3%80%81%e7%94%b5","status":"publish","type":"post","link":"http:\/\/www.olinone.com\/?p=149","title":{"rendered":"iOS\u5f00\u53d1\u4e2d\u5982\u4f55\u68c0\u6d4b\u5f53\u524d\u8fd0\u884c\u5546\u7c7b\u578b(\u79fb\u52a8\u3001\u8054\u901a\u3001\u7535\u4fe1)"},"content":{"rendered":"<h2>iOS\u5f00\u53d1\u4e2d\uff0c\u6709\u65f6\u9700\u8981\u68c0\u6d4b\u8bbe\u5907\u8fd0\u8425\u5546\u7c7b\u578b\uff0c\u5982\u79fb\u52a8\u3001\u8054\u901a\u6216\u8005\u7535\u4fe1\uff0c\u672c\u6587\u4ee5\u68c0\u6d4b\u8054\u901a\u4e3a\u4f8b\u3002<\/h2>\n<h3>\u7cfb\u7edf\u4ee3\u7801<\/h3>\n<pre class=\"lang:objc highlight:0 decode:true\">- (BOOL)checkIsUnicom\r\n{\r\n    CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];\r\n    CTCarrier *carrier = info.subscriberCellularProvider;\r\n    NSString *carrierName = carrier.carrierName;\r\n    NSString *mobileCountryCode = carrier.mobileCountryCode;\r\n    NSString *mobileNetworkCode = carrier.mobileNetworkCode;\r\n    [info release];\r\n    if (!mobileNetworkCode) {\r\n        return NO;\r\n    }\r\n    if ([mobileCountryCode intValue]==460) { \/\/\u56fd\u5185\r\n        return [carrierName rangeOfString:@\"\u8054\u901a\"].length&gt;0 || [mobileNetworkCode isEqualToString:@\"01\"] || [mobileNetworkCode isEqualToString:@\"06\"];\r\n    }\r\n    return [self statusBarCheckIsUnicom];\r\n}<\/pre>\n<h4>\u8fd0\u884c\u5546\u5bf9\u5e94\u7684NetworkCode<\/h4>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" src=\"http:\/\/olinone.qiniudn.com\/chinanet.png\" alt=\"\" width=\"761\" height=\"361\" \/><\/p>\n<p>\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u4ee5\u4e0a\u4ee3\u7801\u53ef\u6ee1\u8db3\u6b63\u5e38\u9700\u6c42\uff0c\u4f46\u662f\u5bf9\u4e8e\u7f8e\u7248\u6216\u8005\u65e5\u7248\u5361\u8d34iPhone\uff0c\u68c0\u6d4b\u5230\u7684CTCarrier\u5e76\u975esim\u5361\u4fe1\u606f\uff0c\u6b64\u65f6\u5c31\u9700\u8981\u901a\u8fc7StatusBar\u5b9e\u65f6\u68c0\u6d4b\u5f53\u524d\u7f51\u7edc\u8fd0\u884c\u5546<\/p>\n<pre class=\"lang:objc highlight:0 decode:true \">- (BOOL)statusBarCheckIsUnicom\r\n{\r\n    NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@\"statusBar\"] valueForKey:@\"foregroundView\"] subviews];\r\n    UIView *serviceView = nil;\r\n    Class serviceClass = NSClassFromString([NSString stringWithFormat:@\"UIStat%@Serv%@%@\", @\"usBar\", @\"ice\", @\"ItemView\"]);\r\n    for (UIView *subview in subviews) {\r\n        if([subview isKindOfClass:[serviceClass class]]) {\r\n            serviceView = subview;\r\n            break;\r\n        }\r\n    }\r\n    if (serviceView) {\r\n        NSString *carrierName = [serviceView valueForKey:[@\"service\" stringByAppendingString:@\"String\"]];\r\n        return [carrierName rangeOfString:@\"\u8054\u901a\"].length&gt;0;\r\n    } else {\r\n        return NO;\r\n    }\r\n}<\/pre>\n<p>\u559c\u6b22\u8bf7\u70b9\u8d5e-&gt;<a href=\"https:\/\/github.com\/panghaijiao\">https:\/\/github.com\/panghaijiao<\/a>\uff0c\u8c22\u8c22\u4f60\u7684\u6765\u8bbf\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS\u5f00\u53d1\u4e2d\uff0c\u6709\u65f6\u9700\u8981\u68c0\u6d4b\u8bbe\u5907\u8fd0\u8425\u5546\u7c7b\u578b\uff0c\u5982\u79fb\u52a8\u3001\u8054\u901a\u6216\u8005\u7535\u4fe1\uff0c\u672c\u6587\u4ee5\u68c0\u6d4b\u8054\u901a\u4e3a\u4f8b\u3002 \u7cfb\u7edf\u4ee3\u7801 &#8211; (BOOL\u2026 <span class=\"read-more\"><a href=\"http:\/\/www.olinone.com\/?p=149\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/posts\/149"}],"collection":[{"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.olinone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=149"}],"version-history":[{"count":4,"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":385,"href":"http:\/\/www.olinone.com\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions\/385"}],"wp:attachment":[{"href":"http:\/\/www.olinone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.olinone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.olinone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}