title: How do I use CaptiveNetwork to get the current WiFi Hotspot Name
body: <p>I need to get the name of the currently connected Wi-Fi hotspot, e.g. "BT OpenZone"</p>
  
  <p>I have been told it can be done with <a href="http://developer.apple.com/library/ios/#documentation/SystemConfiguration/Reference/CaptiveNetworkRef/Reference/reference.html" rel="noreferrer">CaptiveNetwork</a> specifically CNCopyCurrentNetworkInfo</p>
  
  <p>My code so far:</p>
  
  <pre><code>#import &lt;SystemConfiguration/CaptiveNetwork.h&gt;
  ...
  
  // Get the dictionary containing the captive network infomation
  CFDictionaryRef captiveNtwrkDict = CNCopyCurrentNetworkInfo(kCNNetworkInfoKeySSID);
  
  // Get the count of the key value pairs to test if it has worked
  int count = CFDictionaryGetCount(captiveNtwrkDict);
  NSLog(@"Count of dict:%d",count);
  </code></pre>
  
  <p>When the code runs on a device in a WiFi hotspot the <code>captiveNtwrkDict</code> is nil.</p>
  
  <p>Has anyone managed to get it working?  I cant find much documentation or any example code examples on CaptiveNetworks...  any help would be much appreciated.</p>