2015-09-17 47 views
-1

了以下錯誤:當我使用Xcode 7時,我得到了這個?有任何想法嗎?

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

在下面的代碼:

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

image

+1

是你不允許使用它。你應該使用NSString * language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];獲取用戶的主要語言爲您的應用程序。看到更多:http://stackoverflow.com/questions/3910244/getting-current-device-language-in-ios – BooRanger

+0

感謝您的幫助! –

回答

1

UIKeyboardInputMode是一個私有的類。

因此,您不允許調用此方法/屬性。您將不得不,這使得不可能在AppStore中發佈代碼。

+0

感謝您的幫助! –

相關問題