質問

Hi I am Looking for a Simple Code to read the SSID, I found a lot of Information about "SystemConfiguration/CaptiveNetwork.h" but how can I use it, i don't understand it. Sorry I am a new Objective-C programmer. Do you have a good example or tutorial to understand it. I tried Reachable from Apple but they don't work with Dictionaries.

Thanks for help

役に立ちましたか?

解決

Thank you @helming, here it is, this way it won't compile into the Simulator binary + added calls to CFRelease:

#if !TARGET_IPHONE_SIMULATOR
    CFArrayRef interfaces = CNCopySupportedInterfaces();
    CFDictionaryRef networkInfo = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(interfaces, 0));
    NSString *ssid = CFDictionaryGetValue(networkInfo, @"SSID");
    CFRelease(interfaces);
    CFRelease(networkInfo);
#endif

他のヒント

CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSString *ssid = CFDictionaryGetValue(myDict, @"SSID");
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top