问题
Here is my code which was working before.
NotificationCenter.default.addObserver(self, selector: #selector(ImageScrollView.changeOrientationNotification), name: Notification.Name.UIDevice.orientationDidChangeNotification, object: nil)
回答1:
Remove Notification.Name.
prefix:
NotificationCenter.default.addObserver(self, selector: #selector(ImageScrollView.changeOrientationNotification), name: UIDevice.orientationDidChangeNotification, object: nil)
The constants for notifications names were moved in iOS 12 SDK which came with Xcode 10.
来源:https://stackoverflow.com/questions/54693092/type-notification-name-aka-nsnotification-name-has-no-member-uidevice