Call webServer startWithOptions instead of startWithPort
建议使用 webServer.startWithOptions(["BindToLocalhost":true,"Port":xxxx]) 来避免提示允许监听端口
This commit is contained in:
@ -176,7 +176,7 @@ GCDWebServer *webServer =nil;
|
|||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"];
|
NSString * address = [defaults stringForKey:@"PacServer.ListenAddress"];
|
||||||
int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
|
int port = (short)[defaults integerForKey:@"PacServer.ListenPort"];
|
||||||
[webServer startWithPort:port bonjourName:@"webserver"];
|
[webServer startWithOptions:@{@"BindToLocalhost":@YES, @"Port":@(port)} error:nil];
|
||||||
return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
|
return [NSString stringWithFormat:@"%@%@:%d%@",@"http://",address,port,routerPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user