NSCurrentLocaleDidChangeNotification on iPhone OS
While the NSCurrentLocaleDidChangeNotification
perfectly makes sense on Mac OS X, I don't see how you can possibly receive it on iPhone OS. In order to change the locale, you have to quit the running application, then change it in Settings → General → International → Region Format. At that point, your app is not running, so how could it receive the notification?
I first thought this notification was leftover from the Mac OS X documentation, but then I found this in 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.
So, how do you tri开发者_JAVA百科gger this notification on iPhone OS?
For now, you don't, since you can't run any apps while the locale is being changed. In the future, you might (hint hint*).
Note that you can poll the current locale via +[NSLocale currentLocale]
as usual.
* I am not privy to any insider info.
精彩评论