I am attempting to put together a small utility to allow users to connect to a wireless network in a university setting. The original solution was a combination of shell scripts, apple scripts, and a touch of Obj-C. This had it's own problems. I've since taken it upon myself to try to do the same in a single set of code.
This post was incredible useful. However the sample was for a PSK security mode. The documentation that Apple provides has not been the greatest. The example code provided was also lacking if you want to create a profile on behalf of previously provided credentials.
I get that I can use setPassphrase, but what about a username or even a domain? I can't find any reference to either of those properties.
Lastly, I attempted to tweak the sample code to my purposes. I came across two things. The first was upon changing the securitymode, it complained about a domain property not being configured/existing.
The second (and more irritating since the changes didn't matter) : After compiling and actually running the code, I throw an error at CWConfiguration *conf = [airport configuration];
The error is *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
. From what I can see in xcode, airport is holding en1 at the 0 of the array. There's content, so I don't understand why it claims nil.
My goal is to create a little utility that a person can provide their enterprise credentials for, I t开发者_Python百科ake those credentials and create a WPA2_Enterprise wireless profile and save it to their preferred networks. Also during this process I hope to add a pair of certificates to their keychain that are tied to a radius server. Not sure if the order of operations would affect my ability to create a wireless profile that uses a username, userpassword, and domain. (My knowledge of the network is limited. If I need to go learn more in order to do this, I'm willing.)
Thanks for reading
a later edit
Playing around with it, once I added a minimum of two networks into the preferred networks area by hand, I stopped getting the nil error. However the app requests permission to edit a fake keychain item while adding it's own next to it. Also, the profile still does not appear in the preferred networks list in System Preferences. I feel I'm missing something obvious and oh so close to getting it.
精彩评论