为什么 OSX 中的今天小部件名称总是 "Widget"?

Why name of today widget in OSX is always "Widget"?

我正在学习 today-extension OSX 的小部件编程(目前不是 iOS)。我正在尝试开发一个日历小部件作为一种实践。

但是通知中心的小部件的标题或名称总是"Widget",而不是我设置的。

我更改了所有位置的 InfoPlist.strings 中 "CFBundleDisplayName" 的值(目前只有 Base 和简体中文)。

InfoPlist.strings(基础)

/* Display name and description for this extension. */
"CFBundleDisplayName" = "This Month";
"com.apple.notificationcenter.widget.description" = "Show calendar for this month";

InfoPlist.strings(简体中文)

/* Display name and description for this extension. */
"CFBundleDisplayName" = "本月";
"com.apple.notificationcenter.widget.description" = "显示本月月历";

另外,我修改了Widget组中Info.plist中"Bundle display name"的值,编译目标是Widget。

当我在Widget Simulator 中测试widget 时,它的名称是我在InfoPlist.strings 中设置的。但是当我编译(甚至清理和编译)和 运行 整个应用程序,然后打开通知中心时,我的新小部件的名称始终是 "Widget"。

根据指南(https://developer.apple.com/library/mac/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW6),widget的名称应该在InfoPlist.strings中设置,其他地方都没有提到。

我是不是遗漏了一些重要的设置文件或代码有什么问题?

代码可以在https://github.com/programus/this-month

中找到

仅供参考,我是如何解决同样问题的。

将捆绑包显示名称更新为您想要的任何名称

Widget/InfoPlist.strings

  "CFBundleDisplayName" = "My App";

退出 XCode.

退出 Widget 模拟器

进入Activity监控应用并退出Notification Center进程名称。

通知中心将使用更新后的捆绑包显示名称重新启动。