CNCopySupportedInterfaces stopped returning WiFi data in iOS 12
Originator: | demid.itsk | ||
Number: | rdar://43280182 | Date Originated: | 2018-08-14 |
Status: | Closed | Resolved: | YES |
Product: | SystemConfiguration Framework | Product Version: | iOS 12 (16A5345f) |
Classification: | Bug | Reproducible: | Always |
Area: SystemConfiguration Framework Summary: CNCopySupportedInterfaces doesn't provide data about the current WiFi network (SSID / BSSID), when the app is build with Xcode 10 beta 5 (10L221o). There are no deprecation warnings in the docs or anything like it. Previously this API was briefly disabled in iOS 9 beta, but it was brought back in the final version of iOS 9, so I'm hoping it will be back in the GM iOS 12 as well. Steps to Reproduce: 1) Install Xcode 10 beta 5 (10L221o) 2) Add the following code sample to your app: - (NSDictionary *)fetchSSIDInfo { NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces()); NSDictionary *SSIDInfo; for (NSString *interfaceName in interfaceNames) { SSIDInfo = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName)); if (SSIDInfo.count > 0) { break; } } return SSIDInfo; } ... NSDictionary *ssidInfo = [self fetchSSIDInfo]; NSString *ssid = ssidInfo[@"SSID"]; NSString *bssid = ssidInfo[@"BSSID"]; 3) Build the app with Xcode 10 and run on an iOS 12 device (tried on iPad Air 2 with iOS 12 (16A5345f)). The device must be connected to a WiFi network. Expected Results: ssid and bssid contain corresponding values. Actual Results: ssid and bssid are nil. In fact, CNCopySupportedInterfaces only returns an en0 interface. Version/Build: Xcode 10 beta 5 (10L221o) iOS 12 (16A5345f) iPad Air 2 (MNV72RU/A) Configuration:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Xcode Version
The "Access WiFi Information" capability does not exist for my app in XCode 9.3. I have already added the following to my .entitlements file:
Will we be required to upgrade to Xcode 10 for any WiFi support on iOS 12, or is this addition safe using Xcode 9.3?
Apple Developer Relations
Engineering has the following feedback for you: There is no special consideration for this entitlement, and any application can have this entitlement. Thank you for your feedback. Engineering has determined that this issue behaves as intended. We are now closing this bug report. If you just have questions about the resolution, then please update your bug report with that information so we can respond.
Developer
Thanks you! Indeed, my mistake. I missed that new entitlement. Could you please tell if there are any special considerations when using this entitlement? For instance, maybe only a certain type of apps is allowed to use it?
Apple Developer Relations
Engineering has determined that this issue behaves as intended based on the following information: To use CNCopyCurrentNetworkInfo() function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. When you enable this capability, Xcode automatically adds the Access WiFi Information entitlement to your entitlements file and App ID. Have you added the required entitlement in your application? Please see https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo for more details.
Developer
May be relevant to: rdar://21983334 rdar://22081099 rdar://22006095