Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xxfenxx opened this issue Jan 4, 2018 · 0 comments
Open

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

xxfenxx opened this issue Jan 4, 2018 · 0 comments

Comments

@xxfenxx
Copy link

xxfenxx commented Jan 4, 2018

① :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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant