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

Setting shouldAdvertise and shouldDiscover in init #21

Open
iasandcb opened this issue Jun 25, 2015 · 1 comment
Open

Setting shouldAdvertise and shouldDiscover in init #21

iasandcb opened this issue Jun 25, 2015 · 1 comment

Comments

@iasandcb
Copy link

The current code is

    switch (startOption) {
        case DIStartAdvertisingAndDetecting:
            _shouldAdvertise = YES;
            _shouldDiscover = YES;
            break;
        case DIStartAdvertisingOnly:
            _shouldAdvertise = YES;
            break;
        case DIStartDetectingOnly:
            _shouldDiscover = YES;
            break;
        case DIStartNone:
        default:
            break;
    }

but, setting properties instead of setting ivars is necessary because otherwise Discovery won't start ad and scan.

    switch (startOption) {
        case DIStartAdvertisingAndDetecting:
            self.shouldAdvertise = YES;
            self.shouldDiscover = YES;
            break;
        case DIStartAdvertisingOnly:
            self.shouldAdvertise = YES;
            break;
        case DIStartDetectingOnly:
            self.shouldDiscover = YES;
            break;
        case DIStartNone:
        default:
            break;
    }
@iasandcb
Copy link
Author

The current workaround is

    discovery = Discovery(UUID: uuid, username: UIDevice.currentDevice().name, startOption:DIStartOptions.None, usersBlock: { (users: [AnyObject]!, usersChanged: Bool) -> Void in
        println("CH", usersChanged)
        println("OK", users.count)
    })
    discovery.shouldAdvertise = true
    discovery.shouldDiscover = true

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