Swifterswift: Using NetworkExtension module in UIDeviceExtension

Created on 19 Jul 2018  路  5Comments  路  Source: SwifterSwift/SwifterSwift

Hi! I'm working on an extension of UIDevice to give people access to bssid, ssid and signal strength by simple doing
let SSID = UIDevice.current.ssid

The extension is working as expected but it needs special entitlements to work. You can request those at https://developer.apple.com//contact/request/network-extension/ .

What should I do now? Should the library itself include entitlements? (But can it?)
Should the library include just the extension, giving to the users the job to add entitlements to their apps?
Should the library not at all include such an extension, since it requires special entitlements ?

[x ] I've read, understood, and done my best to follow the Contributing guidelines before opening this issue.

discussion help wanted new extension

All 5 comments

Update: Apple responded me that they will not give me entitlements for a library.

So two options remain:

  • we include just the code, and the user is responsible of adding entitlements if he wants to use this extension (A #warning in Swift 4.2 ?)
  • we don't include such an extension at all, meaning that maybe we should close related issues.

@marcocapano You have to request special entitlements for network extension for obtaining list of visible WiFi ssids, for gathering only current active I use no extra capabilities.

import SystemConfiguration.CaptiveNetwork

extension UIDevice {

    public var SSID: String? {

        guard let interfaceNames = CNCopySupportedInterfaces() as? [String] else {
            return nil
        }
        return interfaceNames.compactMap { name in
            guard let info = CNCopyCurrentNetworkInfo(name as CFString) as? [String:AnyObject] else {
                return nil
            }
            guard let ssid = info[kCNNetworkInfoKeySSID as String] as? String else {
                return nil
            }
            return ssid
            }.first
    }
}

So in the same way you can get BSSID and some other current wifi connection's properties

Thanks, I'll give it a look. I'm planning to make a pull request by this evening

Haven't read this entire thread but SSID -> ssid if anyone adds an extension from the discussion 馃槢

Thank you for your extension @marcocapano
I think we should not include extensions that require specific entitlements

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omaralbeik picture omaralbeik  路  3Comments

martinstoyanov picture martinstoyanov  路  5Comments

SD10 picture SD10  路  3Comments

bjimenezned picture bjimenezned  路  3Comments

omaralbeik picture omaralbeik  路  3Comments