diff --git a/README.md b/README.md index 90e12aa..c481a68 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,8 @@ ref: [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) - [ ] Embed the http proxy server [privoxy](http://www.privoxy.org/). ## Know Issue -[Issue 1.]() Auto PAC & White list is not working on macOS 10.12 Serria because system proxy not allow [file:///](file:///) protocol. +Solved [Issue 1.]() Auto PAC & White list is not working on macOS 10.12 Serria because system proxy not allow [file:///](file:///) protocol. +[Issue 2.]() The net speed is how ever have some problem with macOS 10.12, welcome logs from all users. ## License diff --git a/ShadowsocksX-NG/NetWorkMonitor.swift b/ShadowsocksX-NG/NetWorkMonitor.swift index 1b41350..d56d74e 100755 --- a/ShadowsocksX-NG/NetWorkMonitor.swift +++ b/ShadowsocksX-NG/NetWorkMonitor.swift @@ -26,7 +26,24 @@ public class NetWorkMonitor: NSObject { func startUpdateTimer() { timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(updateNetWorkData), userInfo: nil, repeats: true) - NSRunLoop.currentRunLoop().run() + if #available(OSX 10.12, *){ + + let alertView = NSAlert() + alertView.messageText = "网速显示不支持 macOS 10.12 Sierra!" + alertView.informativeText = "因为 macOS 10.12 Sierra ABI 不稳定,因此暂时移除网速功能" + alertView.addButtonWithTitle("取消网速显示") + alertView.runModal() + let defaults = NSUserDefaults.standardUserDefaults() + defaults.setBool(false, forKey: "enable_showSpeed") + +// NSRunLoop.currentRunLoop().run() +// CFRunLoopRun() + + } else { + NSRunLoop.currentRunLoop().addTimer(timer!, forMode: NSRunLoopCommonModes) + NSRunLoop.currentRunLoop().run() + print(NSRunLoop.currentRunLoop().getCFRunLoop()) + } } func stop(){ diff --git a/ShadowsocksX-NG/PingClient.swift b/ShadowsocksX-NG/PingClient.swift index c3f4776..5318023 100644 --- a/ShadowsocksX-NG/PingClient.swift +++ b/ShadowsocksX-NG/PingClient.swift @@ -101,7 +101,7 @@ class PingServers:NSObject{ self.fastest = latency self.fastest_id = i }else{ - if latency < self.fastest{ + if Int(latency!) < Int(self.fastest!) { self.fastest = latency self.fastest_id = i }