tigo texto saber mensaje leyeron leido informe hangouts han fue entregado entrega como claro objective-c key-value-observing

objective c - texto - “El mensaje fue recibido pero no manejado” KVO



como saber si un sms de texto fue leido (2)

Cuando ejecuto un proyecto, obtengo lo siguiente en mi ventana de resultados:

An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: connection.messageQueue Observed object: <Client: 0x10011ddb0> ...

Tienes la idea La cosa es que no tengo idea de por qué esto está sucediendo. Parece que todo está funcionando bien, sin embargo. Aquí está el código que causa el problema:

-(id) initWithIdentifier:(NSString*)ident andClient:(Client*)chatClient { if(![super initWithNibName:@"ChatView" bundle:nil]) { return nil; } [self setTitle: ident]; client = chatClient; [self setIdentifier:ident]; inContext = false; [client addObserver:self forKeyPath:@"connection.messageQueue" options:NSKeyValueObservingOptionNew context:NULL]; return self; } -(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSAttributedString* rar = [[NSAttributedString alloc] initWithString:@"test"]; [[textView textStorage] appendAttributedString:rar]; [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; }

Pensé en mostrar todo el código relacionado con esto. La clase solo tiene algunos métodos, así que esto es todo lo que necesitas ver. Ni siquiera estoy usando el cambio, solo estoy presionando "prueba" cuando se desencadena el evento KVO.

El seguimiento de la pila se hace muy grande muy rápidamente ya que los mensajes llegan todo el tiempo. Sin embargo, parece que todo está funcionando bien.

¿Alguna pista?


No debe llamar a [super observeValueForKeyPath:ofObject:change:context:] si maneja la notificación. Solo debe llamar a esto para las notificaciones que usted mismo no maneja.


Tengo el mismo problema: An -observeValueForKeyPath: ofObject: change: context: el mensaje se recibió pero no se manejó . He buscado en Google aquí, luego lo descubrí por mi cuenta, así que tal vez ayude a alguien.

Para mí, el problema fue: el objeto registrado como observador (si tiene ... addObserver: self ... entonces ese objeto es self ) se liberó en el momento en que se cambió el valor. Pero el observador todavía estaba registrado, por lo que -observeValueForKeyPath:ofObject:change:context: el observador nil recibió el mensaje.