I want to detect current input mode of keyboard, and change text direction with respect to it (rtl if Arabic, and ltr if English).
In the following code:
- (void)viewDidLoad
{
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter]
        addObserver:self
           selector:@selector(changeInputMode:)
               name:UITextInputCurrentInputModeDidChangeNotification
             object:nil
    ];
 }
-(void)changeInputMode:(NSNotification *)notification
{
    UITextInputMode *thisInputMode = [notification object];
    NSLog(@"inputMethod=%@",thisInputMode);
}
thisInputMode is nil!
If I use this code instead:
    NSString *inputMethod = [[UITextInputMode currentInputMode] primaryLanguage];
    NSLog(@"inputMethod=%@",inputMethod);
It works fine and detects current input mode, but currentInputMode is deprecated.
Why [notification object] returns nil?
 
     
     
     
    