LDNetDiagnoService_IOS icon indicating copy to clipboard operation
LDNetDiagnoService_IOS copied to clipboard

以下代码可以审核通过并上线,不是私有API?

Open xxfenxx opened this issue 7 years ago • 0 comments

① :NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews]; ②:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]

以上代码中的类和属性都没有对外暴露,可以上线?

===============================================

/*!

  • 获取当前网络类型
  • 通过statusBar的网络subview获取具体类型 */
  • (NETWORK_TYPE)getNetworkTypeFromStatusBar { NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews]; NSNumber *dataNetworkItemView = nil; for (id subview in subviews) { if ([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) { dataNetworkItemView = subview; break; } } NETWORK_TYPE nettype = NETWORK_TYPE_NONE; NSNumber *num = [dataNetworkItemView valueForKey:@"dataNetworkType"]; nettype = [num intValue]; return nettype; }

xxfenxx avatar Jan 04 '18 15:01 xxfenxx