My Reachability Notifier is only able to be called once

前端 未结 2 456
天命终不由人
天命终不由人 2021-01-16 03:19

So, I have the following in my AppDelegate.
It will notify my when I turn my WIFI off but will not react after that initial run.
I have had this working in the past.

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-16 03:47

    Try passing nil for the object parameter in addObserver. Also, for Swift 3, I had to initialize it with self.reachability = Reachability.forInternetConnection()

提交回复
热议问题