sonidos recuperar pantalla notificaciones historial funciona centro borradas bloqueada aparece ios iphone notifications parse.com parse-platform push

ios - recuperar - sonidos notificaciones iphone



El dispositivo habilitado con iOS 8 no recibe notificaciones PUSH después de la actualización del código (8)

Agregue esta línea en la parte superior de su archivo .m

#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

1) Tiene que poner condición cuando se registra para la notificación push en IOS8 . agregar este código en la aplicación did finish launch .

if(IS_IOS_8_OR_LATER) { UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes: (UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert) categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; } else { //register to receive notifications UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound; [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes]; }

2) Luego agregue estos métodos para IOS8

#ifdef __IPHONE_8_0 - (void)application:(UIApplication *)application didRegisterUserNotificationSettings: (UIUserNotificationSettings *)notificationSettings { //register to receive notifications [application registerForRemoteNotifications]; } - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler { //handle the actions if ([identifier isEqualToString:@"declineAction"]){ } else if ([identifier isEqualToString:@"answerAction"]){ } } #endif

Entonces se llamará a su método de delegado de notificación. Espero que esto te ayudará !!!

Recientemente actualicé uno de mis iphones de prueba a iOS 8 y luego actualicé el código de registro PUSH como se muestra a continuación (usando xCode 6)

-(BOOL)hasNotificationsEnabled { NSString *iOSversion = [[UIDevice currentDevice] systemVersion]; NSString *prefix = [[iOSversion componentsSeparatedByString:@"."] firstObject]; float versionVal = [prefix floatValue]; if (versionVal >= 8) { NSLog(@"%@", [[UIApplication sharedApplication] currentUserNotificationSettings]); //The output of this log shows that the app is registered for PUSH so should receive them if ([[UIApplication sharedApplication] currentUserNotificationSettings].types != UIUserNotificationTypeNone) { return YES; } } else { UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (types != UIRemoteNotificationTypeNone){ return YES; } } return NO; } -(void)registerForPUSHNotifications { NSString *iOSversion = [[UIDevice currentDevice] systemVersion]; NSString *prefix = [[iOSversion componentsSeparatedByString:@"."] firstObject]; float versionVal = [prefix floatValue]; if (versionVal >= 8) { //for iOS8 UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } else { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; } }

A pesar de esta actualización y el hecho de que [[UIApplication sharedApplication] currentUserNotificationSettings] muestra que PUSH está habilitado para el dispositivo, no recibo notificaciones de PUSH.

Estoy usando Parse y hago todo lo que el libro dice en lo que a ellos respecta ( https://parse.com/tutorials/ios-push-notifications ).

¿Alguien está experimentando el mismo problema? ¿Hay algo más que pueda estar perdiendo?


Intenté obtener la información de tipo del objeto de configuración y descubrí que la propiedad de tipos es básicamente una máscara de bits. Así es como puede extraer la información.

Sin embargo, mi ejemplo está en Swift y> = iOS 8.0.

let settings = UIApplication.sharedApplication().currentUserNotificationSettings() if settings.types.rawValue & UIUserNotificationType.Alert.rawValue == UIUserNotificationType.Alert.rawValue { // can receive alert! } else { // if the user is not even able to receive alerts, show him a hint on how to reenable notifications in system settings } if settings.types.rawValue & UIUserNotificationType.Badge.rawValue == UIUserNotificationType.Badge.rawValue { // can receive badge! } if settings.types.rawValue & UIUserNotificationType.Sound.rawValue == UIUserNotificationType.Sound.rawValue { // can receive sound! }


La forma de registrarse para las notificaciones push ha cambiado en iOS 8: a continuación se muestra el código para todas las versiones hasta iOS 9:

if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) { [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; } else { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; }

En caso de que desee verificar si las notificaciones push están habilitadas o no, utilice el siguiente código:

- (BOOL) pushNotificationOnOrOff { if ([UIApplication instancesRespondToSelector:@selector(isRegisteredForRemoteNotifications)]) { return ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications]); } else { UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; return (types & UIRemoteNotificationTypeAlert); } } #ifdef __IPHONE_8_0 - (void)application:(UIApplication *)application didRegisterUserNotificationSettings: (UIUserNotificationSettings *)notificationSettings { //register to receive notifications [application registerForRemoteNotifications]; } - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler { //handle the actions if ([identifier isEqualToString:@"declineAction"]){ } else if ([identifier isEqualToString:@"answerAction"]){ } } #endif

El código anterior solo se ejecutará en Xcode 6+ ...


Pruebe esto si tiene iOS 8 y versiones anteriores:

if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) { // For iOS 8 [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } else { // For iOS < 8 [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; }

Desde el sitio de desarrollo de Apple:

UIUserNotificationSettings

Un objeto UIUserNotificationSettings encapsula los tipos de notificaciones que su aplicación puede mostrar al usuario. Las aplicaciones que usan alertas visibles o audibles junto con una notificación local o automática deben registrar los tipos de alertas que emplean. UIKit correlaciona la información que proporciona con las preferencias del usuario para determinar qué tipos de alertas puede utilizar su aplicación.

Use esta clase para encapsular su solicitud de registro inicial y ver los resultados de la solicitud. Después de crear una instancia de esta clase y especificar su configuración preferida, llame al registerUserNotificationSettings: método de la clase UIApplication para registrar esa configuración. Después de verificar su solicitud con las preferencias del usuario, la aplicación entrega los resultados a la application:didRegisterUserNotificationSettings: método de su delegado de la aplicación. El objeto pasado a ese método especifica los tipos de notificaciones que su aplicación puede usar.

Además de registrar los tipos de alertas de su aplicación, también puede usar esta clase para registrar grupos de acciones personalizadas para mostrar junto con notificaciones locales o push. Las acciones personalizadas representan tareas inmediatas que su aplicación puede realizar en respuesta a la notificación. Define grupos de acciones y asocia todo el grupo con una notificación dada. Cuando se muestra la alerta correspondiente, el sistema agrega botones para cada acción que especificó. Cuando el usuario toca el botón para una de las acciones, el sistema activa su aplicación y llama a la application:handleActionWithIdentifier:forRemoteNotification:completionHandler: o application:handleActionWithIdentifier:forLocalNotification:completionHandler: método de su delegado de aplicaciones. Use esos métodos para realizar la acción solicitada.


Tiempo de ejecución y opciones seguras del compilador antiguo ... si se ejecuta en xcode antiguo (5.0 o anterior)

// changes of API in iOS 8.0 - (void) registerForPushNotification { NSLog(@"registerForPushNotification"); if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0 //__IPHONE_8_0 is not defined in old xcode (==0). Then use 80000 NSLog(@"registerForPushNotification: For iOS >= 8.0"); [[UIApplication sharedApplication] registerUserNotificationSettings: [UIUserNotificationSettings settingsForTypes: (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications]; #endif } else { NSLog(@"registerForPushNotification: For iOS < 8.0"); [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; } }


Es muy sencillo:

Agregue la siguiente línea en didFinishLaunchingWithOptions de su proyecto en xcode6

[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications];


if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) { // For iOS 8 [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } else { // For iOS < 8 [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; }

Después de este:

  1. Elimine las aplicaciones que ya no tienen notificaciones Push del dispositivo.
  2. Apague el dispositivo por completo y vuelva a encenderlo.
  3. Vaya a la configuración y configure la fecha y la hora un día antes
  4. Apague el dispositivo nuevamente y vuelva a encenderlo
  5. Instale las aplicaciones nuevamente y solicitará una notificación como la primera vez que lo instaló.
  6. Restablezca su fecha / hora nuevamente si no se configura automáticamente.

Esto restablecerá la configuración de notificaciones. Vuelva a instalar la aplicación y todo funcionará bien :)


The code below resolved: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { UIUserNotificationType types; types = [[UIApplication sharedApplication] currentUserNotificationSettings].types; if (types & UIUserNotificationTypeAlert) pushEnabled=YES; else pushEnabled=NO; } else { UIRemoteNotificationType types; types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; if (types & UIRemoteNotificationTypeAlert) pushEnabled=YES; else pushEnabled=NO; }