<legend id='2mmUr'><style id='2mmUr'><dir id='2mmUr'><q id='2mmUr'></q></dir></style></legend>

    1. <tfoot id='2mmUr'></tfoot>
        <bdo id='2mmUr'></bdo><ul id='2mmUr'></ul>

      <small id='2mmUr'></small><noframes id='2mmUr'>

      <i id='2mmUr'><tr id='2mmUr'><dt id='2mmUr'><q id='2mmUr'><span id='2mmUr'><b id='2mmUr'><form id='2mmUr'><ins id='2mmUr'></ins><ul id='2mmUr'></ul><sub id='2mmUr'></sub></form><legend id='2mmUr'></legend><bdo id='2mmUr'><pre id='2mmUr'><center id='2mmUr'></center></pre></bdo></b><th id='2mmUr'></th></span></q></dt></tr></i><div id='2mmUr'><tfoot id='2mmUr'></tfoot><dl id='2mmUr'><fieldset id='2mmUr'></fieldset></dl></div>

        我正确使用 CNCopyCurrentNetworkInfo 吗?

        时间:2023-10-05

            <bdo id='Maap4'></bdo><ul id='Maap4'></ul>
                <legend id='Maap4'><style id='Maap4'><dir id='Maap4'><q id='Maap4'></q></dir></style></legend>

                <small id='Maap4'></small><noframes id='Maap4'>

                  <tbody id='Maap4'></tbody>
                <i id='Maap4'><tr id='Maap4'><dt id='Maap4'><q id='Maap4'><span id='Maap4'><b id='Maap4'><form id='Maap4'><ins id='Maap4'></ins><ul id='Maap4'></ul><sub id='Maap4'></sub></form><legend id='Maap4'></legend><bdo id='Maap4'><pre id='Maap4'><center id='Maap4'></center></pre></bdo></b><th id='Maap4'></th></span></q></dt></tr></i><div id='Maap4'><tfoot id='Maap4'></tfoot><dl id='Maap4'><fieldset id='Maap4'></fieldset></dl></div>
              1. <tfoot id='Maap4'></tfoot>

                  本文介绍了我正确使用 CNCopyCurrentNetworkInfo 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我对 CNCopyCurrentNetworkInfo 返回的数据有一些问题,我想知道我是否做错了什么.

                  I'm having some issues with the data returned by CNCopyCurrentNetworkInfo and was wondering if I'm doing something wrong.

                  我正在使用以下代码来显示当前连接的接入点的 BSSID:

                  I'm using the following code to display the BSSID of the currently connected Access Point:

                  NSArray* interfaces = (NSArray*) CNCopySupportedInterfaces();  
                  
                  for (NSString* interface in interfaces) {
                  
                  CFDictionaryRef networkDetails = CNCopyCurrentNetworkInfo((CFStringRef) interface);
                  if (networkDetails) {
                      NSLog(@"all details: %@", (NSDictionary *)networkDetails);
                      NSLog(@"BSSID: %@", (NSString *)CFDictionaryGetValue (networkDetails, kCNNetworkInfoKeyBSSID));
                      CFRelease(networkDetails);
                      }
                  }
                  

                  通过查看 NSLog 语句,似乎 CNCopyCurrentNetworkInfo 在某些情况下挂在 kCNNetworkInfoKeyBSSID 的旧数据上.

                  By reviewing the NSLog statements it appears as though CNCopyCurrentNetworkInfo is hanging onto old data for kCNNetworkInfoKeyBSSID under certain circumstances.

                  我设置了两个接入点,我正在尝试获取当前连接的 AP 的 BSSID.如果我一开始只打开一个 AP,它会返回正确的 BSSID.如果我关闭那个 AP,我就没有 BSSID(正确),当我打开第二个 AP 并连接到它时,我会得到第二个 AP 的正确 BSSID.

                  I have two access points set up and I'm trying to obtain the BSSID of the currently connected AP. If I start with only one AP turned on it returns the correct BSSID. If I switch that AP off I get no BSSID (correct) and when I switch on the second AP and connect to it I am given the correct BSSID of the second AP.

                  但是,如果我从打开一个 AP 开始运行此代码并正确获得该 AP 的 BSSID.然后我打开第二个 AP,然后关闭第一个(强制设备漫游到第二个 AP),日志语句仍然返回第一个 AP 的 BSSID(我已关闭并且可能未连接到).

                  However if I start with one AP turned on run this code and am correctly given the BSSID of that AP. I then turn on the second AP, then turn off the first (forcing the device to roam to the second AP) the log statements still return the BSSID of the first AP (which I have turned off and am not possibly connected to).

                  有没有人比我有更多的经验?我是否打算在调用之间手动刷新 CNCopyCurrentNetworkInfo 返回的值?

                  Does anyone have more experience with this than I've had? Am I meant to be manually flushing the values returned by CNCopyCurrentNetworkInfo between calls?

                  我已经在运行使用 Xcode 4 构建的 iOS 4.3 的第 4 代 iPod touch 和运行使用 Xcode 3.2.4 构建的 iOS 4.1 的 iPhone 4 上运行此程序

                  I am have run this on both a 4th gen iPod touch running iOS 4.3 built using Xcode 4 and an iPhone 4 running iOS 4.1 built using Xcode 3.2.4

                  推荐答案

                  我将提供这个问题的答案,因为它似乎偶尔会获得赞成票并且可以提供解决方案.

                  I'm going to provide an answer to this question because it seems to get the occasional up vote and could do with a solution.

                  简短的版本是,是的,这就是您应该使用 CNCopyCurrentNetworkInfo 的方式.这是 iOS 4 和 5 中的一个错误.如果您当前运行的是 iOS 6 测试版,我建议您调查它是否仍然以这种方式运行,如果是,则向 Apple 报告.

                  Short version is that yes that is how you're supposed to use CNCopyCurrentNetworkInfo. This is a bug in iOS 4 and 5. If you're currently running an iOS 6 beta I would suggest investigating whether it still operates this way on there and reporting it to Apple if it does.

                  我很幸运,因为我从事企业应用程序的工作,并且能够通过调用私有 API 来获取这些信息.有关如何执行此操作的信息,我可能会建议您查看此处:iphone-wireless on google code

                  I was fortunate in that I work on enterprise applications and was able to gain this information using calls to private APIs. For info on how to do this I would probably recommend looking here: iphone-wireless on google code

                  这篇关于我正确使用 CNCopyCurrentNetworkInfo 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在应用程序中使用多个网络接口 下一篇:android 解析 .local (mDNS)

                  相关文章

                  <legend id='kV74v'><style id='kV74v'><dir id='kV74v'><q id='kV74v'></q></dir></style></legend>
                1. <tfoot id='kV74v'></tfoot>

                  1. <small id='kV74v'></small><noframes id='kV74v'>

                    <i id='kV74v'><tr id='kV74v'><dt id='kV74v'><q id='kV74v'><span id='kV74v'><b id='kV74v'><form id='kV74v'><ins id='kV74v'></ins><ul id='kV74v'></ul><sub id='kV74v'></sub></form><legend id='kV74v'></legend><bdo id='kV74v'><pre id='kV74v'><center id='kV74v'></center></pre></bdo></b><th id='kV74v'></th></span></q></dt></tr></i><div id='kV74v'><tfoot id='kV74v'></tfoot><dl id='kV74v'><fieldset id='kV74v'></fieldset></dl></div>
                      <bdo id='kV74v'></bdo><ul id='kV74v'></ul>