Ohh, after spending so much time, I can say below things.
SSID Info - After requesting location, it always gives null on first call to get ssid info but then subsequent calls return SSID info as expected.
BSSID Info - BSSID info remains null during all the calls
@eskimo Do you think I should file a BUG for this BSSID info case also for SSID info case?
Post
Replies
Boosts
Views
Activity
Here is the content of Info.plist
Just to add more info SSID and BSSID info both are null.
<?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>CFBundleExecutable</key>
<string>osx-core-location</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.osx-core-location.tk</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSLocationAlwaysUsageDescription</key>
<string>For WiFi access</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>For WiFi access</string>
</dict>
</plist>
@eskimo Thanks for the response.
I am also able to get Latitude/Longitude info, then why SSID info is getting hidden if OS doesn't like my agent then it should not give me location info as well?
Is there anyway my application will be treated on par as GUI application even though it does not have any GUI app?
Currently I am using ~/Library/LaunchAgents with below plist
<plist version="1.0">
<dict>
<key>StandardOutPath</key>
<string>/tmp/app.log</string>
<key>StandardErrorPath</key>
<string>/tmp/app.log</string>
<key>Label</key>
<string>test.osx</string>
<key>ProgramArguments</key>
<array>
<string>/Users/test/Desktop/Location.app/Contents/MacOS/osx-core-location</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
@pyro_90 I am going through same issue, can you please help how did you resolve your issue? Even though I am able to get latitude and longitude info, still SSID info is null.
Just to add more info, currently if I try to connect with nil ssid object with the help of associateToEnterpriseNetwork:identity:username:password:error: it crashes with
2024-01-08 12:00:35.291 osx-core-location[35472:7987323]
Object choosen: <CWNetwork: 0x600001f40000> [ssid=(null), bssid=(null), security=(null), rssi=-24, channel=<CWChannel: 0x600001f40180> [channelNumber=116(5GHz), channelWidth={80MHz}], ibss=0]
SIGILL: illegal instruction
PC=0x7ff80be65610 m=0 sigcode=1
signal arrived during cgo execution
Thanks Quinn, for looking into query. Yes, I am using ARC Mode while compiling.
You are perfectly right, even on my Xcode 14.2 above code is building perfectly and working as expected. Key shows up into keychain.
I remembered your earlier answer to my one of post that there is difference between permission when we execute CLI over SSH vs VNC and using Terminal. And that is where my issue was lying.
Thanks a lot for quick help.
I am getting same error with very simple below code as well, Also I analysed that hex value of NSLog is having same value. Is there any logs I can refer to further debug this ?
void SetUsernamePassword(char * cOnexuser, char * cOnexpass) {
NSString * onexuser = [[NSString alloc] initWithUTF8String:cOnexuser];
NSString * onexpass = [[NSString alloc] initWithUTF8String:cOnexpass];
NSData * nssid = [@"Testing" dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"NSSData: %@", nssid);
CWKeychainDomain d = kCWKeychainDomainUser;
OSStatus err;
err = CWKeychainSetWiFiEAPUsernameAndPassword(d, nssid, onexuser, onexpass);
NSLog(@"Status: %d", err);
}
Hi Nishant, Did you get any working solution with respect to BSSID nil?
Hi, Did you get any fix for this issue? Looks like my problem is same, after using above call I can connect to Ssid but if I reboot Mac then after reboot it is asking for username and password again. Did you get any working solution? I tried with different routine corewlan seteapusernameandpassword as well but no avail.
Hi eskimo,
I am able to successfully execute code below, also er is null but seems after switch off / on Wi-Fi from UI again it is asking for username and password.
OSStatus er = CWKeychainSetWiFiEAPUsernameAndPassword(d, nssid, onexuser, onexpass);
NSLog(@"Status: %@", er);```
Am I using wrong routine?
Would appreciate help here.
Hi Experts, Any hint appreciated.
Thank you for such prompt reply.
I was going through the article and I must say it is very heavy to understand. I have one suggestion, It is totally missing one example where we can get all the steps to sign any code with respect to for example, App wants permission to get Location or any other type of permission with Apple Developer Account and how to sign/use that app in context of executable binary launchd (not developed with xcode, we can consider it developed in some other language, as normal xcode development process has handled through UI, I guess.).
I tried with launchd and looks like it is not working for me, I guess some info.plist or any other issue. Very hard to understand as not being Mac Developer hurting my chance to get into RCA.
Thanks for the prompt response.
I am writing one agent which need to scan WiFi and check for BSSID into golang, so once I compile this executable I currently run it from terminal(ssh into apple machine and run it manually through CMD) during development phase, once I am done developing it, will be run through separate process Via a launchd agent or Via a launchd daemon so user does not need to run it every time manually after boot.
If you want to see sample code part, I can host it over github for your reference as well, let me know which ever way works for you.
Thanks for the explanation.
So I am wondering that if my application is going to be used in background only from CLI, will signing my code will give BSSID? Otherwise I can avoid spending time on this to understand how process works to sign code and all
On similar line, on MAC OS 13.x behaviour has changed looks like, once I allow Python location service from UI, I can see BSSID values. So behaviour has changed from at least older release.