How to know when user made change to settings bundle

后端 未结 3 1002
我在风中等你
我在风中等你 2021-02-20 09:42

I let the user make changes to their settings in the settings area of the iphone. During the next network sync i\'d like to send the user changes to the server. But only if the

3条回答
  •  忘了有多久
    2021-02-20 10:18

    Swift

    Observe for changes and call a method on change:

    NotificationCenter.default.addObserver(
        self,
        selector: #selector(updateStateFromSettingsBundle),
        name: UserDefaults.didChangeNotification,
        object: nil
    )
    
    @objc func updateStateFromSettingsBundle() {}
    

提交回复
热议问题