0

I'm trying to query in a todayViewController, however whenever I run this extension it asks me to set the client ID (where I did in the app delegate.m). Then I added the extension as a target membership of the AppDelegate.m. However, the code:

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

works not fine for the extension as the error mentioned from the console. Then I tried comment this part out, the today extension runs, but there has no any reaction. I added the query in

- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
// Perform any setup necessary in order to update the view.
completionHandler(NCUpdateResultNewData);
}

please help! thanks in advance for helps!

xpeng
  • 23
  • 4

1 Answers1

0

Today extensions are not permitted to access [UIApplication sharedApplication], so code that needs to use UIApplication methods is for the most part also not permitted.

It doesn't really make a lot of sense for a today extension to be registering for notifications anyway. That should be done by the containing app (i.e. your app). There's no need to do it in both places.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170