I am trying to get the name of the WIFI network my app is currently connected to. I've tried reachability, CaptiveNetwork, and other methods but none of the code compiles in XCode 5. I don't need anything fancy except for the network name. Please advise. Thanks
Asked
Active
Viewed 145 times
0
-
Various duplicates, e.g. [iPhone get SSID without private library](http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library) and [Can the iPhone SDK obtain the Wi-Fi SSID currently connected to?](http://stackoverflow.com/questions/339089/can-the-iphone-sdk-obtain-the-wi-fi-ssid-currently-connected-to) – Paul R Oct 13 '13 at 07:09
-
Suggested duplicates are 2 and 4 years old. How are they related to the **XCode 5** issue? – Rok Jarc Oct 13 '13 at 12:38
-
I have read over and tried both of those examples, Paul, several times, but they DO NOT WORK IN XCODE 5. THEY DO NOT COMPILE. THIS IS NOT A DUPLICATE QUESTION. – Fawrkes Oct 13 '13 at 15:33
-
@user2837165: it's a better idea to modify your question a bit (put XCode 5 in bold, add the links/methods you had tried, tell us what kind of errors you are getting) than yelling with all caps. Though i agree with you: if this is Xcode 5 issue then suggested duplicates are not really duplicates. It is probably just a compiler-setting problem. But it's hard to help if you don't even provide us the information on the errors you are getting. – Rok Jarc Oct 14 '13 at 06:07
-
I tried a code that should work with XCode 5 (can't post it as an answer since this question is closed...). Create an empty application. Add `SystemConfiguration` framework. Then `#import
` into your `appDelegate.m`. – Rok Jarc Oct 14 '13 at 12:09 -
The code would be: `- (void)fetchSSIDInfo { #if (TARGET_IPHONE_SIMULATOR) NSLog (@"Will not work on simulator); #else CFArrayRef myArray = CNCopySupportedInterfaces(); CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0)); if (myDict) { NSString *currentSSID = CFDictionaryGetValue(myDict, kCNNetworkInfoKeySSID); NSLog (@"SSID: %@", currentSSID); CFRelease(myDict); CFRelease(myArray); } else { NSLog (@"No SSID info"); } #endif } ` – Rok Jarc Oct 14 '13 at 12:10
-
@PaulR: please consider reopening the question. Suggested "duplicate" Q&A are 2 and 4 years ago. Way before XCode5 was released. – Rok Jarc Oct 14 '13 at 12:16
-
@user2837165: I suggest you update your question to explain that you have tried the previous solutions and explain *why* they don't work any more. Without this information the question just looks like a duplicate. With enough background info to distinguish this from other similar questions I'm sure the question can be re-opened. – Paul R Oct 14 '13 at 12:21