Wednesday, December 30, 2015

Enable Wi-Fi AP list when starting an app

Note: The information below is for iOS 8. For iOS 9, refer to NEHotspotHelper.

Normally iOS developers cannot write some code to show Wi-Fi hotspots around an iPhone / iPad. The iDevice user has to select Setting -> Wi-Fi to access a list of nearby Wi-Fi networks.

Although there are a lot of programming restrictions with Wi-Fi functions, it is still possible to show a list of surrounding Wi-Fi APs by modifying the Info.plist file.

1. Create a new project and edit the Info.plist property list file as below:

Key: Application uses Wi-Fi
Type: Boolean
Value: YES



Another way of modification is to open Info.plist as source code and add the UIRequiresPersistentWiFi key as true:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>

2. Select Setting -> Wi-Fi. Turn on both Wi-Fi and Ask to Join Networks.


3. Run the app. The Select a Wireless Network window is automatically popped up.

No comments:

Post a Comment