Skip to content

fix nehelper error due failed to fetch CNCopyCurrentNetworkInfo #99

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Discovery/DiscoveryManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
#import "AppStateChangeNotifier.h"

#import <SystemConfiguration/CaptiveNetwork.h>
#import <CoreLocation/CoreLocation.h>

@interface DiscoveryManager() <DiscoveryProviderDelegate, ServiceConfigDelegate>
@property(strong, nonatomic) CLLocationManager* locationManager;

@end

Expand Down Expand Up @@ -131,6 +133,9 @@ - (instancetype) initWithAppStateChangeNotifier:(nullable AppStateChangeNotifier
[sself resumeDiscovery];
};

_locationManager = [[CLLocationManager alloc] init];
[_locationManager requestWhenInUseAuthorization];

[self startSSIDTimer];
}

Expand Down Expand Up @@ -244,6 +249,8 @@ - (void) unregisterDeviceService:(Class)deviceClass withDiscovery:(Class)discove

- (void) startSSIDTimer
{
[_ssidTimer invalidate];

_ssidTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(detectSSIDChange) userInfo:nil repeats:YES];
[_ssidTimer fire];
}
Expand All @@ -256,6 +263,10 @@ - (void) stopSSIDTimer

- (void) detectSSIDChange
{
if ([_locationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined ||
[_locationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
return;
}
NSArray *interfaces = (__bridge_transfer id) CNCopySupportedInterfaces();

__block NSString *ssidName;
Expand Down Expand Up @@ -482,6 +493,7 @@ - (void) stopDiscovery
if (!_shouldResumeSearch)
{
[self.appStateChangeNotifier stopListening];
[self stopSSIDTimer];
}
}

Expand Down