Re: Adding the com.apple.security.network.client entitlement
Re: Adding the com.apple.security.network.client entitlement
- Subject: Re: Adding the com.apple.security.network.client entitlement
- From: Carl Hoefs <email@hidden>
- Date: Mon, 01 Oct 2018 17:31:20 -0700
Yes, you are 100% correct (of course)! I was barking up the wrong tree!
I also created a stripped-down CoreWLAN tool from scratch in Xcode 10, and it
works on 10.14 without entitlements.
But my original (much larger) project still wouldn't work! So I created a new
'command line tool' project in Xcode 10 and imported my old code into it. Guess
what -- it works also! And since it's not an app nor sandboxed, it doesn't need
any entitlements but the default get-task-allow.
Very strange, but I've had this happen to me before. Getting Xcode to work
properly with an "ancient" 2006 project can induce insanity. Many thanks for
your efforts and the sanity check!
-Carl
> On Oct 1, 2018, at 4:31 PM, Quinn The Eskimo! <email@hidden> wrote:
>
>
> On 1 Oct 2018, at 13:58, Carl Hoefs <email@hidden> wrote:
>
>> I've tried running the program from within Xcode, as a standalone
>> command-line invocation, and as a Launch Agent, and even using sudo.
>
> I’m not sure what’s going on in your environment but CoreWLAN is working for
> me. I tested it both from an app and from a command-line tool:
>
> * The app was sandboxed, and thus needed the
> `com.apple.security.network.client` entitlement.
>
> * The tool was not sandboxed and thus has no networking entitlements
> (remember that on macOS the App Sandbox is an /app/ sandbox, and is only
> appropriate for apps and app extensions).
>
> In both case the executable was signed with my Developer ID.
>
> My tests shown the same behaviour on 10.13.6 and 10.14, that is:
>
> * A sandboxed app needs the `com.apple.security.network.client` entitlement.
>
> * A non-sandboxed app does not.
>
> * Likewise for a command-line tool.
>
> I’ve included a copy of my command-line tool’s code below, so you can try
> this for yourself. I built it with Xcode 10.0 and ran it on macOS 10.14.
>
> Share and Enjoy
> --
> Quinn "The Eskimo!" <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>
> ---------------------------------------------------------------------------
> import Foundation
> import CoreWLAN
>
> class Main : NSObject, CWEventDelegate {
>
> let client: CWWiFiClient = CWWiFiClient.shared()
>
> func start() throws {
> self.client.delegate = self
> try self.client.startMonitoringEvent(with: .powerDidChange)
> }
>
> func powerStateDidChangeForWiFiInterface(withName interfaceName: String) {
> guard let interface = client.interface(withName: interfaceName) else {
> NSLog("tool power no interface, name: %@", interfaceName)
> return
> }
> let isPowerOn = interface.powerOn()
> NSLog("tool power, name: %@, on: %@", interfaceName, isPowerOn ? "yes"
> : "no")
> }
> }
>
> func mainThrowing() throws {
> NSLog("tool start")
> let m = Main()
> try withExtendedLifetime(m) {
> try m.start()
> dispatchMain()
> }
> }
>
> func main() {
> do {
> try mainThrowing()
> } catch {
> NSLog("tool failed, error: %@", "\(error)")
> }
> }
>
> main()
> exit(EXIT_SUCCESS)
> ---------------------------------------------------------------------------
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden