-1

Got following error:

 no visible @interface for 'NSString' declares the selector 'primaryLanguage'

at following code:

 NSString *lang = [[[UITextInputMode activeInputModes] firstObject] primaryLanguage];
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~
```NSString *lang = [[[UITextInputMode activeInputModes] firstObject] primaryLanguage];```

image

WannaBeGeek
  • 979
  • 14
  • 32
  • 1
    Yup your not allowed use it. You should use NSString * language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0]; to get the users primary language for your app. see more at: http://stackoverflow.com/questions/3910244/getting-current-device-language-in-ios – BooRanger Sep 17 '15 at 10:22
  • thanks for your help! – Zander Zhang Sep 17 '15 at 10:57

1 Answers1

1

UIKeyboardInputMode is a private class.

Therefore, you are not allowed to call this method/property. You would have to add the private header, which makes it impossible to publish the code in the AppStore.

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117