Question

When I register for CoreWLAN notifications (with a retained interface) like this:

 [[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(recieveNetworkNotificationAndRedirectToMainThread:) 
                                             name:CWSSIDDidChangeNotification 
                                           object:nil];

I receive the notification only when I have all entitlements disabled. None of the default entitlements allow me to receive this (or other CoreWLAN) notification.

Any ideas?

10.7.4


Edit 1:

The Entitlements Reference page did not provide any assistance.


Edit 2:

Faking the notification works fine:

  [[NSNotificationCenter defaultCenter] 
 postNotificationName:CWSSIDDidChangeNotification 
 object:self];  

And none of the other CoreWLAN notifications are received either.

I am sure that this is a simple entitlement that I'm missing... Here is the entitlement file with the temp exception for Growl (removing the temp exception has no effect either):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.device.usb</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-only</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.network.server</key>
    <true/>
    <key>com.apple.security.temporary-exception.apple-events</key>
    <string>com.Growl.GrowlHelperApp</string>
    <key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
    <string>GrowlApplicationBridgePathway</string>
</dict>
</plist>

Edit 3:

Compiling for 10.6 using the old k-prefixed notification names has no effect either.


Edit 4:

More information from the logs:

AppName (39009) deny system-socket

Process: AppName [39009] Path:
/Users/username/Library/Developer/Xcode/DerivedData/AppName-fnxrpqnodsouovcaxgiocvnfpqor/Build/Products/Release/AppName/Contents/MacOS/AppName Load Address: 0x10d23f000 Identifier: AppName Version:
??? (???) Code Type: X86-64 (Native) Parent Process: debugserver [39007]

Date/Time: 2012-07-20 13:17:11.851 -0700 OS Version: Mac OS X 10.7.4 (11E2705) Report Version: 7

Backtrace: 0 libsystem_kernel.dylib 0x00007fff98704e76 socket + 10 1 CoreWLAN 0x00007fff951f4a6f Apple80211EventMonitoringInit2 + 53 2 CoreWLAN
0x00007fff951e6dc4 -[CWInterface initWithInterfaceName:] + 1358 3
CoreWLAN 0x00007fff951e412d +[CWInterface interfaceWithName:] + 52 4 CoreWLAN
0x00007fff951e41a8 +[CWInterface interface] + 98


Edit 5:

Found this reference to deny system-socket in sandboxd, but no help yet.

Was it helpful?

Solution

I am able to get SSID changes and updates with my app sandboxed using the networknotifier code in hardwaregrowler - I think because its looking for specific notifications.

http://code.google.com/p/growl/source/browse/Extras/HardwareGrowler/?name=default

Once I am notified of a change:

if(wif==nil){
    wif = [CWInterface interface];
    [wif retain];
}
if(!wif.serviceActive){
    skip=TRUE;
}
if(wif.ssid==nil){
    skip=TRUE;
}
if(!skip)
if(wif){
    NSLog(@"We are on the WiFi network: %@",wif.ssid);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top