Programus
Programus

Reputation: 358

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

I am learning today-extension widget programming for OSX (not iOS currently). And I am trying to develop a calendar widget as a practice.

But the title or the name of the widget in notification center is always "Widget" instead of what I set.

I changed the value of "CFBundleDisplayName" in InfoPlist.strings of all locations (currently only Base and Simplified Chinese).

InfoPlist.strings (Base)

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

InfoPlist.strings (Simplified Chinese)

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

Also, I changed the value of "Bundle display name" in Info.plist in Widget group which compile target is the Widget.

When I test the widget in Widget Simulator, its name is what I set in InfoPlist.strings. But when I compile (even clean & compile) and run the whole application, and then open the notification center, the name of my new widget is always "Widget".

According to the guide (https://developer.apple.com/library/mac/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW6), the name of widget should be set in InfoPlist.strings and nowhere else is mentioned.

Did I miss some important setting file or anything wrong with the code?

The code could be found in https://github.com/programus/this-month

Upvotes: 4

Views: 1042

Answers (1)

Miguel
Miguel

Reputation: 20633

Just for reference this how I resolved the same issue.

Update Bundle Display Name to whatever you want

Widget/InfoPlist.strings

  "CFBundleDisplayName" = "My App";

Quit XCode.

Quit Widget Simulator.

Go into Activity Monitor app and quit Notification Center process name.

Notification Center will restart with updated Bundle Display Name.

Upvotes: 7

Related Questions