4

我正在学习今天的 OSX 扩展小部件编程(目前不是 iOS)。我正在尝试开发一个日历小部件作为一种练习。

但是通知中心小部件的标题或名称始终是“小部件”而不是我设置的。

我更改了所有位置的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。

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

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

我是否错过了一些重要的设置文件或代码有什么问题?

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

4

1 回答 1

7

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

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

Widget/InfoPlist.strings

  "CFBundleDisplayName" = "My App";

退出XCode

退出小部件模拟器

进入活动监视器应用程序并退出Notification Center进程名称。

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

于 2015-06-28T22:17:24.680 回答