├── .gitignore ├── EFNEHotspotHelperDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── eyrefree.xcuserdatad │ └── xcschemes │ ├── EFNEHotspotHelperDemo.xcscheme │ └── xcschememanagement.plist ├── EFNEHotspotHelperDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── 20@2x.png │ │ ├── 20@3x.png │ │ ├── 29@2x.png │ │ ├── 29@3x.png │ │ ├── 40@2x.png │ │ ├── 40@3x.png │ │ ├── 60@2x.png │ │ ├── 60@3x.png │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── EFNEHotspotHelperDemo.entitlements ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── README.md └── assets └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | # Pods/ 34 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 12E915781E702F5C008B295B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 12E915771E702F5C008B295B /* main.m */; }; 11 | 12E9157B1E702F5C008B295B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 12E9157A1E702F5C008B295B /* AppDelegate.m */; }; 12 | 12E9157E1E702F5C008B295B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 12E9157D1E702F5C008B295B /* ViewController.m */; }; 13 | 12E915811E702F5C008B295B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12E9157F1E702F5C008B295B /* Main.storyboard */; }; 14 | 12E915831E702F5C008B295B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 12E915821E702F5C008B295B /* Assets.xcassets */; }; 15 | 12E915861E702F5C008B295B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12E915841E702F5C008B295B /* LaunchScreen.storyboard */; }; 16 | 12E9158F1E703009008B295B /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12E9158E1E703009008B295B /* ExternalAccessory.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 12E915731E702F5C008B295B /* EFNEHotspotHelperDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EFNEHotspotHelperDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 12E915771E702F5C008B295B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 22 | 12E915791E702F5C008B295B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | 12E9157A1E702F5C008B295B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | 12E9157C1E702F5C008B295B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | 12E9157D1E702F5C008B295B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | 12E915801E702F5C008B295B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 12E915821E702F5C008B295B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 12E915851E702F5C008B295B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 12E915871E702F5C008B295B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 12E9158E1E703009008B295B /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; }; 31 | 12E915901E703009008B295B /* EFNEHotspotHelperDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = EFNEHotspotHelperDemo.entitlements; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 12E915701E702F5C008B295B /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | 12E9158F1E703009008B295B /* ExternalAccessory.framework in Frameworks */, 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 12E9156A1E702F5C008B295B = { 47 | isa = PBXGroup; 48 | children = ( 49 | 12E915751E702F5C008B295B /* EFNEHotspotHelperDemo */, 50 | 12E915741E702F5C008B295B /* Products */, 51 | 12E9158D1E703009008B295B /* Frameworks */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | 12E915741E702F5C008B295B /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 12E915731E702F5C008B295B /* EFNEHotspotHelperDemo.app */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | 12E915751E702F5C008B295B /* EFNEHotspotHelperDemo */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 12E915901E703009008B295B /* EFNEHotspotHelperDemo.entitlements */, 67 | 12E915791E702F5C008B295B /* AppDelegate.h */, 68 | 12E9157A1E702F5C008B295B /* AppDelegate.m */, 69 | 12E9157C1E702F5C008B295B /* ViewController.h */, 70 | 12E9157D1E702F5C008B295B /* ViewController.m */, 71 | 12E9157F1E702F5C008B295B /* Main.storyboard */, 72 | 12E915821E702F5C008B295B /* Assets.xcassets */, 73 | 12E915841E702F5C008B295B /* LaunchScreen.storyboard */, 74 | 12E915871E702F5C008B295B /* Info.plist */, 75 | 12E915761E702F5C008B295B /* Supporting Files */, 76 | ); 77 | path = EFNEHotspotHelperDemo; 78 | sourceTree = ""; 79 | }; 80 | 12E915761E702F5C008B295B /* Supporting Files */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 12E915771E702F5C008B295B /* main.m */, 84 | ); 85 | name = "Supporting Files"; 86 | sourceTree = ""; 87 | }; 88 | 12E9158D1E703009008B295B /* Frameworks */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 12E9158E1E703009008B295B /* ExternalAccessory.framework */, 92 | ); 93 | name = Frameworks; 94 | sourceTree = ""; 95 | }; 96 | /* End PBXGroup section */ 97 | 98 | /* Begin PBXNativeTarget section */ 99 | 12E915721E702F5C008B295B /* EFNEHotspotHelperDemo */ = { 100 | isa = PBXNativeTarget; 101 | buildConfigurationList = 12E9158A1E702F5C008B295B /* Build configuration list for PBXNativeTarget "EFNEHotspotHelperDemo" */; 102 | buildPhases = ( 103 | 12E9156F1E702F5C008B295B /* Sources */, 104 | 12E915701E702F5C008B295B /* Frameworks */, 105 | 12E915711E702F5C008B295B /* Resources */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = EFNEHotspotHelperDemo; 112 | productName = EFNEHotspotHelperDemo; 113 | productReference = 12E915731E702F5C008B295B /* EFNEHotspotHelperDemo.app */; 114 | productType = "com.apple.product-type.application"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | 12E9156B1E702F5C008B295B /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | LastUpgradeCheck = 0820; 123 | ORGANIZATIONNAME = EyreFree; 124 | TargetAttributes = { 125 | 12E915721E702F5C008B295B = { 126 | CreatedOnToolsVersion = 8.2.1; 127 | DevelopmentTeam = P3X2725LYY; 128 | ProvisioningStyle = Automatic; 129 | SystemCapabilities = { 130 | com.apple.WAC = { 131 | enabled = 1; 132 | }; 133 | }; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 12E9156E1E702F5C008B295B /* Build configuration list for PBXProject "EFNEHotspotHelperDemo" */; 138 | compatibilityVersion = "Xcode 3.2"; 139 | developmentRegion = English; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 12E9156A1E702F5C008B295B; 146 | productRefGroup = 12E915741E702F5C008B295B /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 12E915721E702F5C008B295B /* EFNEHotspotHelperDemo */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | 12E915711E702F5C008B295B /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | 12E915861E702F5C008B295B /* LaunchScreen.storyboard in Resources */, 161 | 12E915831E702F5C008B295B /* Assets.xcassets in Resources */, 162 | 12E915811E702F5C008B295B /* Main.storyboard in Resources */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | /* End PBXResourcesBuildPhase section */ 167 | 168 | /* Begin PBXSourcesBuildPhase section */ 169 | 12E9156F1E702F5C008B295B /* Sources */ = { 170 | isa = PBXSourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 12E9157E1E702F5C008B295B /* ViewController.m in Sources */, 174 | 12E9157B1E702F5C008B295B /* AppDelegate.m in Sources */, 175 | 12E915781E702F5C008B295B /* main.m in Sources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXSourcesBuildPhase section */ 180 | 181 | /* Begin PBXVariantGroup section */ 182 | 12E9157F1E702F5C008B295B /* Main.storyboard */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | 12E915801E702F5C008B295B /* Base */, 186 | ); 187 | name = Main.storyboard; 188 | sourceTree = ""; 189 | }; 190 | 12E915841E702F5C008B295B /* LaunchScreen.storyboard */ = { 191 | isa = PBXVariantGroup; 192 | children = ( 193 | 12E915851E702F5C008B295B /* Base */, 194 | ); 195 | name = LaunchScreen.storyboard; 196 | sourceTree = ""; 197 | }; 198 | /* End PBXVariantGroup section */ 199 | 200 | /* Begin XCBuildConfiguration section */ 201 | 12E915881E702F5C008B295B /* Debug */ = { 202 | isa = XCBuildConfiguration; 203 | buildSettings = { 204 | ALWAYS_SEARCH_USER_PATHS = NO; 205 | CLANG_ANALYZER_NONNULL = YES; 206 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 207 | CLANG_CXX_LIBRARY = "libc++"; 208 | CLANG_ENABLE_MODULES = YES; 209 | CLANG_ENABLE_OBJC_ARC = YES; 210 | CLANG_WARN_BOOL_CONVERSION = YES; 211 | CLANG_WARN_CONSTANT_CONVERSION = YES; 212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INFINITE_RECURSION = YES; 217 | CLANG_WARN_INT_CONVERSION = YES; 218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 219 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | DEBUG_INFORMATION_FORMAT = dwarf; 225 | ENABLE_STRICT_OBJC_MSGSEND = YES; 226 | ENABLE_TESTABILITY = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu99; 228 | GCC_DYNAMIC_NO_PIC = NO; 229 | GCC_NO_COMMON_BLOCKS = YES; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 237 | GCC_WARN_UNDECLARED_SELECTOR = YES; 238 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 239 | GCC_WARN_UNUSED_FUNCTION = YES; 240 | GCC_WARN_UNUSED_VARIABLE = YES; 241 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 242 | MTL_ENABLE_DEBUG_INFO = YES; 243 | ONLY_ACTIVE_ARCH = YES; 244 | SDKROOT = iphoneos; 245 | }; 246 | name = Debug; 247 | }; 248 | 12E915891E702F5C008B295B /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 254 | CLANG_CXX_LIBRARY = "libc++"; 255 | CLANG_ENABLE_MODULES = YES; 256 | CLANG_ENABLE_OBJC_ARC = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_CONSTANT_CONVERSION = YES; 259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 260 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INFINITE_RECURSION = YES; 264 | CLANG_WARN_INT_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNREACHABLE_CODE = YES; 268 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 269 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 272 | ENABLE_NS_ASSERTIONS = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 283 | MTL_ENABLE_DEBUG_INFO = NO; 284 | SDKROOT = iphoneos; 285 | VALIDATE_PRODUCT = YES; 286 | }; 287 | name = Release; 288 | }; 289 | 12E9158B1E702F5C008B295B /* Debug */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 293 | CODE_SIGN_ENTITLEMENTS = EFNEHotspotHelperDemo/EFNEHotspotHelperDemo.entitlements; 294 | DEVELOPMENT_TEAM = P3X2725LYY; 295 | INFOPLIST_FILE = EFNEHotspotHelperDemo/Info.plist; 296 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 297 | PRODUCT_BUNDLE_IDENTIFIER = EFNEHotspotHelperDemo; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | }; 300 | name = Debug; 301 | }; 302 | 12E9158C1E702F5C008B295B /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | CODE_SIGN_ENTITLEMENTS = EFNEHotspotHelperDemo/EFNEHotspotHelperDemo.entitlements; 307 | DEVELOPMENT_TEAM = P3X2725LYY; 308 | INFOPLIST_FILE = EFNEHotspotHelperDemo/Info.plist; 309 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 310 | PRODUCT_BUNDLE_IDENTIFIER = EFNEHotspotHelperDemo; 311 | PRODUCT_NAME = "$(TARGET_NAME)"; 312 | }; 313 | name = Release; 314 | }; 315 | /* End XCBuildConfiguration section */ 316 | 317 | /* Begin XCConfigurationList section */ 318 | 12E9156E1E702F5C008B295B /* Build configuration list for PBXProject "EFNEHotspotHelperDemo" */ = { 319 | isa = XCConfigurationList; 320 | buildConfigurations = ( 321 | 12E915881E702F5C008B295B /* Debug */, 322 | 12E915891E702F5C008B295B /* Release */, 323 | ); 324 | defaultConfigurationIsVisible = 0; 325 | defaultConfigurationName = Release; 326 | }; 327 | 12E9158A1E702F5C008B295B /* Build configuration list for PBXNativeTarget "EFNEHotspotHelperDemo" */ = { 328 | isa = XCConfigurationList; 329 | buildConfigurations = ( 330 | 12E9158B1E702F5C008B295B /* Debug */, 331 | 12E9158C1E702F5C008B295B /* Release */, 332 | ); 333 | defaultConfigurationIsVisible = 0; 334 | }; 335 | /* End XCConfigurationList section */ 336 | }; 337 | rootObject = 12E9156B1E702F5C008B295B /* Project object */; 338 | } 339 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo.xcodeproj/xcuserdata/eyrefree.xcuserdatad/xcschemes/EFNEHotspotHelperDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo.xcodeproj/xcuserdata/eyrefree.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | EFNEHotspotHelperDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 12E915721E702F5C008B295B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // EFNEHotspotHelperDemo 4 | // 5 | // Created by EyreFree on 17/3/8. 6 | // Copyright © 2017年 EyreFree. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // EFNEHotspotHelperDemo 4 | // 5 | // Created by EyreFree on 17/3/8. 6 | // Copyright © 2017年 EyreFree. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/20@2x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/20@3x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/29@2x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/29@3x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/40@2x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/40@3x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/60@2x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/60@3x.png -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "60@3x.png", 49 | "scale" : "3x" 50 | } 51 | ], 52 | "info" : { 53 | "version" : 1, 54 | "author" : "xcode" 55 | } 56 | } -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/EFNEHotspotHelperDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.external-accessory.wireless-configuration 6 | 7 | 8 | com.apple.developer.networking.HotspotHelper 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIBackgroundModes 24 | 25 | network-authentication 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // EFNEHotspotHelperDemo 4 | // 5 | // Created by EyreFree on 17/3/8. 6 | // Copyright © 2017年 EyreFree. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // EFNEHotspotHelperDemo 4 | // 5 | // Created by EyreFree on 17/3/8. 6 | // Copyright © 2017年 EyreFree. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | 12 | @interface ViewController () 13 | 14 | @property (nonatomic, strong) UITextView *outputLabel; 15 | @property (nonatomic, strong) UIButton *settingButton; 16 | @property (nonatomic, copy) NSString *infoString; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | // 添加控件 26 | [self addControl]; 27 | 28 | // 根据扫描任务添加结果设置按钮状态 29 | [self.settingButton setEnabled: [self scanWifiInfo]]; 30 | 31 | // 添加进入前台时的刷新 32 | [self observeApplicationNotifications]; 33 | } 34 | 35 | - (void)viewWillAppear:(BOOL)animated { 36 | [super viewWillAppear: animated]; 37 | 38 | [self refresh]; 39 | } 40 | 41 | - (void)addControl { 42 | CGSize screenSize = [UIScreen mainScreen].bounds.size; 43 | 44 | self.outputLabel = [[UITextView alloc] initWithFrame: CGRectMake(3, 23, screenSize.width - 6, screenSize.height - 89)]; 45 | self.outputLabel.font = [UIFont systemFontOfSize: 13]; 46 | self.outputLabel.layer.borderWidth = 1; 47 | self.outputLabel.editable = NO; 48 | self.outputLabel.layer.borderColor = [[UIColor blackColor] CGColor]; 49 | [self.view addSubview: self.outputLabel]; 50 | 51 | self.settingButton = [[UIButton alloc] initWithFrame: CGRectMake(3, screenSize.height - 64, screenSize.width - 6, 60)]; 52 | self.settingButton.titleLabel.font = [UIFont systemFontOfSize: 20]; 53 | [self.settingButton setTitle: @"Open WiFi Setting" forState: UIControlStateNormal]; 54 | [self.settingButton setTitleColor: [UIColor blackColor] forState: UIControlStateNormal]; 55 | self.settingButton.layer.borderWidth = 1; 56 | self.settingButton.layer.borderColor = [[UIColor blackColor] CGColor]; 57 | [self.settingButton addTarget: self action:@selector(openWiFiSetting) forControlEvents: UIControlEventTouchUpInside]; 58 | [self.view addSubview: self.settingButton]; 59 | } 60 | 61 | - (BOOL)scanWifiInfo { 62 | NSLog(@"1.Start"); 63 | self.outputLabel.text = @"1.Start"; 64 | 65 | NSMutableDictionary* options = [[NSMutableDictionary alloc] init]; 66 | [options setObject:@"EFNEHotspotHelperDemo" forKey: kNEHotspotHelperOptionDisplayName]; 67 | dispatch_queue_t queue = dispatch_queue_create("EFNEHotspotHelperDemo", NULL); 68 | 69 | NSLog(@"2.Try"); 70 | self.outputLabel.text = @"2.Try"; 71 | 72 | __weak typeof(self) weakself = self; 73 | BOOL returnType = [NEHotspotHelper registerWithOptions: options queue: queue handler: ^(NEHotspotHelperCommand * cmd) { 74 | 75 | NSLog(@"4.Finish"); 76 | 77 | NSMutableString* resultString = [[NSMutableString alloc] initWithString: @""]; 78 | 79 | NEHotspotNetwork* network; 80 | if (cmd.commandType == kNEHotspotHelperCommandTypeEvaluate || cmd.commandType == kNEHotspotHelperCommandTypeFilterScanList) { 81 | // 遍历 WiFi 列表,打印基本信息 82 | for (network in cmd.networkList) { 83 | NSString* wifiInfoString = [[NSString alloc] initWithFormat: @"SSID: %@\nMac地址: %@\n信号强度: %f\nCommandType:%ld\n\n", 84 | network.SSID, network.BSSID, network.signalStrength, (long)cmd.commandType]; 85 | NSLog(@"%@", wifiInfoString); 86 | [resultString appendString: wifiInfoString]; 87 | 88 | // 检测到指定 WiFi 可设定密码直接连接 89 | if ([network.SSID isEqualToString: @"测试 WiFi"]) { 90 | [network setConfidence: kNEHotspotHelperConfidenceHigh]; 91 | [network setPassword: @"123456789"]; 92 | NEHotspotHelperResponse *response = [cmd createResponse: kNEHotspotHelperResultSuccess]; 93 | NSLog(@"Response CMD: %@", response); 94 | [response setNetworkList: @[network]]; 95 | [response setNetwork: network]; 96 | [response deliver]; 97 | } 98 | } 99 | } 100 | 101 | weakself.infoString = resultString; 102 | }]; 103 | 104 | // 注册成功 returnType 会返回一个 Yes 值,否则 No 105 | NSString* logString = [[NSString alloc] initWithFormat: @"3.Result: %@", returnType == YES ? @"Yes" : @"No"]; 106 | NSLog(@"%@", logString); 107 | self.outputLabel.text = logString; 108 | 109 | return returnType; 110 | } 111 | 112 | // 打开 无线局域网设置 113 | - (void)openWiFiSetting { 114 | NSURL* urlCheck1 = [NSURL URLWithString: @"App-Prefs:root=WIFI"]; 115 | NSURL* urlCheck2 = [NSURL URLWithString: @"prefs:root=WIFI"]; 116 | NSURL* urlCheck3 = [NSURL URLWithString: UIApplicationOpenSettingsURLString]; 117 | 118 | NSLog(@"Try to open WiFi Setting, waiting..."); 119 | self.outputLabel.text = @"Try to open WiFi Setting, waiting..."; 120 | 121 | if ([[UIApplication sharedApplication] canOpenURL: urlCheck1]) { 122 | [[UIApplication sharedApplication] openURL: urlCheck1]; 123 | } else if ([[UIApplication sharedApplication] canOpenURL: urlCheck2]) { 124 | [[UIApplication sharedApplication] openURL: urlCheck2]; 125 | } else if ([[UIApplication sharedApplication] canOpenURL: urlCheck3]) { 126 | [[UIApplication sharedApplication] openURL: urlCheck3]; 127 | } else { 128 | NSLog(@"Unable to open WiFi Setting!"); 129 | self.outputLabel.text = @"Unable to open WiFi Setting!"; 130 | 131 | return; 132 | } 133 | NSLog(@"Open WiFi Setting successful."); 134 | self.outputLabel.text = @"Open WiFi Setting successful."; 135 | } 136 | 137 | // 从设置页或者其他地方回来刷新 138 | - (void)observeApplicationNotifications { 139 | [[NSNotificationCenter defaultCenter] removeObserver: self]; 140 | 141 | [[NSNotificationCenter defaultCenter] addObserver: self 142 | selector: @selector(refresh) 143 | name: UIApplicationWillEnterForegroundNotification 144 | object: nil]; 145 | 146 | [[NSNotificationCenter defaultCenter] addObserver: self 147 | selector: @selector(refresh) 148 | name: UIApplicationDidBecomeActiveNotification 149 | object: nil]; 150 | } 151 | 152 | // 刷新获取到的 WiFi 信息 153 | - (void)refresh { 154 | if (self.infoString != nil && ![self.infoString isEqual: @""]) { 155 | self.outputLabel.text = self.infoString; 156 | } 157 | } 158 | 159 | @end 160 | -------------------------------------------------------------------------------- /EFNEHotspotHelperDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // EFNEHotspotHelperDemo 4 | // 5 | // Created by EyreFree on 17/3/8. 6 | // Copyright © 2017年 EyreFree. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 EyreFree 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EFNEHotspotHelperDemo 2 | 3 | A demo show simple use of NEHotspotHelper, get WiFi information list. 4 | 5 | ## Overview 6 | 7 | 8 | 9 | ## Requirements 10 | 11 | - iOS 9.0+ 12 | - NetworkExtension 13 | 14 | ## Introduction 15 | 16 | [http://www.jianshu.com/p/14da35d0b74b](http://www.jianshu.com/p/14da35d0b74b) 17 | 18 | ## Author 19 | 20 | EyreFree, eyrefree@eyrefree.org 21 | 22 | ## License 23 | 24 | EFNEHotspotHelperDemo is available under the MIT license. See the LICENSE file for more info. 25 | -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EyreFree/EFNEHotspotHelperDemo/396939dae41275e8ccb176f6b0cb1cc72f3e8327/assets/screenshot.png --------------------------------------------------------------------------------