尝试此Objective-C的:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// are you running on iOS8?
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge|UIUserNotificationTypeAlert|UIUserNotificationTypeSound) categories:nil];
[application registerUserNotificationSettings:settings];
}
else // iOS 7 or earlier
{
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[application registerForRemoteNotificationTypes:myTypes];
}
}
对于Swift:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
// Override point for customization after application launch.
if(UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:")))
{
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil))
}
else
{
//
}
return true
}
同一个问题:http://stackoverflow.com/questions/20180806/app-with-local-notifications-not-appearing-in-notification-center-list-in-settin?rq=1 – Mikrasya 2014-11-04 03:43:24
同问题(另一种):http://stackoverflow.com/questions/25827650/app-from-app-store-doesnt-show-up-for-all-users-under-notification-center-loca?rq=1 – Mikrasya 2014-11-04 03:43:49
I有同样的问题。很高兴看到我并不孤单。我希望有人能很快找到答案。 – dadThrowsBolts 2014-11-05 17:44:09