Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift NSLocalizedString在iWatch中的应用_Swift_Xcode8_Watchos 2 - Fatal编程技术网

Swift NSLocalizedString在iWatch中的应用

Swift NSLocalizedString在iWatch中的应用,swift,xcode8,watchos-2,Swift,Xcode8,Watchos 2,我在iWatch中将我的应用程序本地化为两种语言。除了在“复杂度”和“警报”对话框中,大多数文本都会本地化 有人能帮我吗 警报代码 let restartAction = WKAlertAction(title: NSLocalizedString("OK", comment: ""), style: .destructive, handler: { //some code here }) let cancelAction = WKAlertAction

我在iWatch中将我的应用程序本地化为两种语言。除了在“复杂度”和“警报”对话框中,大多数文本都会本地化

有人能帮我吗

警报代码

    let restartAction = WKAlertAction(title: NSLocalizedString("OK", comment: ""), style: .destructive, handler: {
        //some code here
    })

    let cancelAction = WKAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel, handler: {})

    presentAlert(withTitle: NSLocalizedString("Restart the page?", comment: ""), message: "", preferredStyle: .alert, actions: [restartAction, cancelAction])
我要解决这个问题:


选择localizable.string文件,并在“文件检查器”>“目标成员资格”中对Watch Extension打上复选标记。

您尝试了什么?您看过哪些apple本地化文档?我使用此函数进行本地化:NSLocalizedString(“页面”,注释:”)您是否将文本添加到您的
可本地化.strings
文件中?是的,我添加了。我在WKInterfaceButton和Alert中使用了相同的文本,在WKInterfaceButton中使用了本地化,但在Alert中没有。