2017-05-04 78 views
1

当我尝试导出我的文件进行翻译我得到这个日志:出口本地化错误

[MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-12169/IDEFoundation/Localization/IDELocalizationWork.m:355 Details: Failed to read strings file "/var/folders/ny/054nwfjs63v3v9rlpkfbt94w0000gn/T/Xcode3SourceStringsAdaptor-EAAAA7F1-000C-432D-BB22-49394ECF78A9/Localizable.strings", underlying error: The data couldn’t be read because it isn’t in the correct format. Object: Method: -work Thread: {number = 1, name = main} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

我检查这个文件,它不属于我的文件,它是空的。为什么Xcode试图去本地化这个文件,而不是我的项目Localizable.strings?每次我尝试导出时,Xcode都会在新的临时文件夹中创建新的空文件。

我使用String扩展,它是将localized计算VAR像here

回答

1

原来,在你的应用程序的代码NSLocalizedString调用导出工具扫描。使用String扩展名时,它无法成功解析源文件。

NSLocalizedString("text_id", comment: "")替换所有"text_id".localized电话后,出口正常工作。

希望它会帮助别人。