虽然 NSCurrentLocaleDidChangeNotification
在 Mac OS X 上完全有意义,但我不知道如何在 iPhone OS 上接收它。为了更改区域设置,您必须退出正在运行的应用程序,然后在设置→常规→国际→区域中进行更改格式。此时,您的应用程序尚未运行,那么它如何收到通知?
我首先以为这个通知是 Mac OS X 文档中遗留下来的,但后来我在 Apple Push Notification Service Programming Guide 中找到了它。 :
The application might send its provider the preferred language every time the user changes something in the current locale. To do this, you can listen for the notification named NSCurrentLocaleDidChangeNotification and, in your notification-handling method, get the code identifying the preferred language and send that to your provider.
那么,如何在 iPhone 操作系统上触发此通知?
最佳答案
目前,您还不需要,因为在更改区域设置时您无法运行任何应用程序。将来,您可能会(提示提示*)。
请注意,您可以照常通过 +[NSLocale currentLocale]
轮询当前区域设置。
* 我不了解任何内幕信息。
关于iphone - iPhone 操作系统上的 NSCurrentLocaleDidChangeNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2508031/