NEHotspotConfigurationManagerを使ってWi-fiに接続する(Objective-C版)
2558 ワード
iOS11からPublic APIとしてWi-fi接続のAPIが公開されたので
今更ですが記述します。
Objective-Cのサンプルって少なくなりましたね〜
事前にcapabilities->Hotspot ConfigurationをONにしておいてください。
hoge.m
#import <NetworkExtension/NetworkExtension.h>
NEHotspotConfigurationManager *manager = [NEHotspotConfigurationManager sharedManager];
NEHotspotConfiguration *config = [[NEHotspotConfiguration alloc] initWithSSID:@"your ssid" passphrase:@"your passwd" isWEP:NO];
[manager applyConfiguration:config completionHandler:^(NSError *error){
if(error) {
NSLog([error localizedDescription]);
}else{
NSLog(@"connected");
}
}];
参考:
https://qiita.com/sushichop/items/3a5682caedf9a8799514
https://dev.classmethod.jp/smartphone/nehotspotconfiguration/
Author And Source
この問題について(NEHotspotConfigurationManagerを使ってWi-fiに接続する(Objective-C版)), 我々は、より多くの情報をここで見つけました https://qiita.com/hellscare/items/9261fdd10348fa0e343d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .