From c0446a49ea128e9a395595f9b3768e6be5dba5ad Mon Sep 17 00:00:00 2001 From: qinyuhang Date: Sun, 9 Oct 2016 17:45:40 +0800 Subject: [PATCH] fix crash on import json config file --- ShadowsocksX-NG/Info.plist | 2 +- ShadowsocksX-NG/ServerProfileManager.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ShadowsocksX-NG/Info.plist b/ShadowsocksX-NG/Info.plist index f672384..3a80941 100644 --- a/ShadowsocksX-NG/Info.plist +++ b/ShadowsocksX-NG/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.4-R + 1.3.4-R8 CFBundleSignature ???? CFBundleURLTypes diff --git a/ShadowsocksX-NG/ServerProfileManager.swift b/ShadowsocksX-NG/ServerProfileManager.swift index e979d7a..1e04f3c 100644 --- a/ShadowsocksX-NG/ServerProfileManager.swift +++ b/ShadowsocksX-NG/ServerProfileManager.swift @@ -111,10 +111,10 @@ class ServerProfileManager: NSObject { self.save() NotificationCenter.default.post(name: Notification.Name(rawValue: NOTIFY_SERVER_PROFILES_CHANGED), object: nil) } - let configsCount = (jsonArr1.object(forKey: "configs") as AnyObject).count + let configsCount = (jsonArr1.object(forKey: "configs") as! [[String: AnyObject]]).count let notification = NSUserNotification() notification.title = "Import Server Profile succeed!".localized - notification.informativeText = "Successful import \(configsCount!) items".localized + notification.informativeText = "Successful import \(configsCount) items".localized NSUserNotificationCenter.default .deliver(notification) }else{