我正在学习Swift 3,并试图使用NSNotificationCenter 。 这是我的代码: func savePost(){ let postData = NSKeyedArchiver.archivedData(withRootObject: _loadedpost) UserDefaults.standard().object(forKey: KEY_POST) } func loadPost(){ if let postData = UserDefaults.standard().object(forKey: KEY_POST) as? NSData{ if let postArray = NSKeyedUnarchiver.unarchiveObject(with: postData as Data) as? [Post]{ _loadedpost = postArray } } //codeerror NotificationCenter.default().post(NSNotification(name: "loadedPost" as NSNotification.Name, object: nil) as Notification) } 这是观察者: override func viewDidLoad() { super.viewDidLoad() […]