wifi
                                
                                 wifi copied to clipboard
                                
                                    wifi copied to clipboard
                            
                            
                            
                        Manager doesn't scan in a launch daemon
Hey! I have created a launch daemon and I am using your great classes for managing iPhone's wifi modules. There is a problem though, I am using this tutorial for creating the launch daemons: https://www.chrisalvares.com/blog/7/creating-an-iphone-daemon-part-1/ When I scan for networks the scan callback function isn't called. Do you know why?
again thanks for your great work!
P.S.I think it's because runloops and these stuff but I know almost nothing about them!! :)
I can't really help you if you don't show me your code. :(
Sorry I didn't have internet access so I am answering after 4 days:) Here is what I do
main.m:
int main (int argc, const char * argv[])
{
@autoreleasepool
{
    NSLog(@"\n\n\n MSManagerStarted 01 \n\n\n");
    // insert code here...
    MSManager *server = [[MSManager alloc] init];
    NSDate *now = [[NSDate alloc] init];
    NSTimer *timer = [[NSTimer alloc] initWithFireDate:now
                                              interval:.01
                                                target:server
                                              selector:@selector(start)
                                              userInfo:nil
                                               repeats:NO];
    NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
    [runLoop addTimer:timer forMode:NSDefaultRunLoopMode];
    [runLoop run];
}
return 0;
}
here is MSManager's class start method implementation:
- (void)start
{
       [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(managerDidFinishScanning) name:kDMNetworksManagerDidFinishScanning object:nil];
        [[DMNetworksManager sharedInstance] scan];
}
But after it is scanned nothing happens. I mean 'managerDidFinishScanning' isn't called. Can you help?
Maybe try to use CFRunLoopRun() instead of your NSDate, NSTimer and NSRunLoop code?
Also, can you check the syslog? Maybe you're missing an important entitlement.
There is no problem with the entitlements. Even with CFRunLoopRun() it doesn't work. Any other ideas?
Can you add an NSLog at the beginning of DMNetworksManager's _scanDidFinishWithError method?
Nothing happens. It gets stuck at _scan method
Have you ever used this in a launch daemon?
Try CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false). Also, make sure that this is the last thing that your main function does.
This doesn't work either:( I can solve my problem another way. What I am trying to do is I want to connect to a given network (the ssid and encryption model and password is given). What i used to do was scan for networks and then if the given said network was scanned then i associated with it. Can I do this another way if there is a problem with scanning?
I think it's because of the entitlements thing. Can you run ldid -e YourBinary on your daemon? ldidis available in Cydia.
here is the result: `
Hm, looks correct. No idea then.
any help with the network association thing? I mean connect to network without scanning.
See -[DMNetworksViewController tableView:didSelectRowAtIndexPath:].