添加权限,改为广播
This commit is contained in:
parent
b6b5f90962
commit
ad1e90604b
|
|
@ -16101,7 +16101,7 @@
|
|||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 9;
|
||||
CURRENT_PROJECT_VERSION = 10;
|
||||
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
|
|
@ -16221,7 +16221,7 @@
|
|||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 9;
|
||||
CURRENT_PROJECT_VERSION = 10;
|
||||
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
|
|
|
|||
|
|
@ -8,5 +8,7 @@
|
|||
<true/>
|
||||
<key>com.apple.external-accessory.wireless-configuration</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.networking.multicast</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@
|
|||
*/
|
||||
- (void)connectAirKissWithSSID:(NSString *)ssidStr
|
||||
password:(NSString *)password {
|
||||
//处理中文的情况
|
||||
if([self validateContainsChinese:ssidStr])
|
||||
{
|
||||
ssidStr = [ssidStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
}
|
||||
NSMutableArray *dataArray = [_airKissEncoder createAirKissEncorderWithSSID:ssidStr ? :@""
|
||||
password:password ? :@""];
|
||||
|
||||
|
|
@ -104,11 +109,11 @@
|
|||
[mData appendBytes:&value length:1];
|
||||
}
|
||||
NSString*host = kAirKiss_Host;
|
||||
if (@available(iOS 16.0, *))
|
||||
{
|
||||
NSArray *arr = [_localIP componentsSeparatedByString:@"."];
|
||||
host=[NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
|
||||
}
|
||||
// if (@available(iOS 16.0, *))
|
||||
// {
|
||||
// NSArray *arr = [_localIP componentsSeparatedByString:@"."];
|
||||
// host=[NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
|
||||
// }
|
||||
|
||||
[_clientUdpSocket sendData:mData
|
||||
toHost:host
|
||||
|
|
@ -135,6 +140,30 @@
|
|||
_clientUdpSocket = nil;
|
||||
_serverUdpSocket = nil;
|
||||
}
|
||||
- (BOOL)validateContainsChinese:(NSString *)content
|
||||
|
||||
{
|
||||
|
||||
// ^[\u4e00-\u9fa5] 以中文开头 的字符串
|
||||
|
||||
// [\u4e00-\u9fa5] 包含中文
|
||||
|
||||
NSRegularExpression *regularexpression = [[NSRegularExpression alloc]
|
||||
|
||||
initWithPattern:@"^[\u4e00-\u9fa5]"
|
||||
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
|
||||
error:nil];
|
||||
|
||||
return ([regularexpression numberOfMatchesInString:content
|
||||
|
||||
options:NSMatchingReportProgress
|
||||
|
||||
range:NSMakeRange(0, content.length)] > 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Set up udp socket
|
||||
- (void)setupClientUdpSocket
|
||||
|
|
|
|||
Loading…
Reference in New Issue