Tengo un secreto EXC_BAD_ACCESS al cambiar el marco de UILabel. El accidente es aleatorio, por lo general tengo que repetir las condiciones durante varios minutos.Crash en actionForLayer: forKey:
La habilitación de NSZombies, así como de otros indicadores de depuración de memoria (NSDebugEnabled, MallocStackLogging), no ayuda, las imágenes bloqueadas permanecen como opacas: solo un BAD_ACCESS sin mensaje en la consola. El objetivo parece correcto y vivo, por lo que no parece un problema de memoria desasignado.
Para conseguir más información, me subclases UILabel y volvió a escribir la función de estrellarse:
@implementation TestUILabel
- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event {
return [super actionForLayer:layer forKey:event];
}
@end
Se estrella en el método de los súper, pero en una inspección todo parece correcto (retainCount la impresión de 'yo' y 'capa' da respectivamente 3 y 2):
(gDB) po auto
< TestUILabel: 0x6ac2800; baseClass = UILabel; frame = (173 174; 0 0); text = '54 m² '; opaco = NO; autoresize = LM + TM; autoresizesSubviews = NO; userInteractionEnabled = NO; animaciones = { position = < CABasicAnimation: 0xe07ba60>; }; capa = < CALayer: 0xbf1b950 >>
(GDB) po evento
límites
(GDB) po capa
< CALayer: 0xbf1b950; position = CGPoint (173 174); bounds = CGRect (0 0; 0 0); delegar = < TestUILabel: 0x6ac2800; baseClass = UILabel; frame = (173 174; 0 0); text = '54 m² '; opaco = NO; autoresize = LM + TM; autoresizesSubviews = NO; userInteractionEnabled = NO; animaciones = { position = < CABasicAnimation: 0xe07ba60>; }; layer = < CALayer: 0xbf1b950 >>; contenido = < CGImage 0xe04ed60>; opacidad = 1; animaciones = [= posición < CABasicAnimation: 0xe07ba60>]>
¿Alguien conseguir un problema similar? ¿O tiene alguna idea de dónde podría venir esto?
¡Gracias de antemano!
Editar: aquí está la traza completa de choque:
Tema 1, cola:
com.apple.principal-hilo
# 0 0x00459b2c en - [UIView (CALayerDelegate) actionForLayer: forKey:]()
# 1 0x00eaaac7 en - [CALayer actionForKey:]()
# 2 0x00ea80fe en actionForKey (CALayer *, CA: : * Transacción, NSString *)()
# 3 0x00ea8066 en beginChange (CALayer *, CA :: * Transacción, unsigned int, objc_object * &)()
# 4 0x00eaba3a en CALayerSetPosition (CALayer *, CA: : Vec2 const &, bool)()
# 5 0x00eab8b5 en - [CALayer setPosition:]()
# 6 0x00 eab7cc en - [CALayer setFrame:]()
# 7 0x0045739d en - [setFrame UIView (geometría):]()
# 8 0x00542a68 en - [UILabel setFrame:]()
# 9 0x0000a97f en - [MosaicElementView setupWithAdvert:] en /Users/eino/Prog/AJ/Classes/Search/SubViews/MosaicElementView.m:30
# 10 0x00079cb9 en - [SearchResultsViewController setupElement: withCell: indexPath: actualIndex:] ()
# 11 0x000797a2 en - [SearchResultsViewController tableView: cellForRowAtIndexPath:]()
# 12 0x004957fa en - [UITableView (UITableViewInternal) _createPreparedCellForGlobalRow: withIndexPath:] ()
# 13 0x0048b77f en - [_createPreparedCellForGlobalRow UITableView (UITableViewInternal):]()
# 14 0x004a0450 en - [_updateVisibleCellsNow UITableView (_UITableViewPrivate):]()
# 15 0x00498538 en - [UITableView layoutSubviews]()
# 16 0x00eb0451 en - [CALayer layoutSublayers]()
# 17 0x00eb017c en CALayerLayoutIfNeeded()
# 18 0x00ea937c en CA :: :: Contexto commit_transaction (CA :: transacción *) ()
# 19 0x00ea90d0 en CA: : Transaction :: commit()()
# 20 0x00ed97d5 en CA :: Transaction :: observer_callbac k (__ CFRunLoopObserver *, unsigned long, void *)()
# 21 0x017e9fbb en __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
# 22 0x0177f0e7 en __CFRunLoopDoObservers()
# 23 0x01747bd7 en __CFRunLoopRun()
# 24 0x01747240 en CFRunLoopRunSpecific ()
# 25 0x01747161 en CFRunLoopRunInMode()
# 26 0x01e7d268 en GSEventRunModal()
# 27 0x01e7d32d en GSEventRun()
# 28 0x0043042e en UIApplicationMain()
# 29 en 0x000021fe principal en /Users/eino/Prog/AJ/main.m:11
La línea crasing desde el marco 9 es básicamente sólo el cambio del marco:
labelPrice.frame = rect;
con el ser rect un CGRect correcto (106, 143, 86, 22).
¿Se puede agregar el registro de bloqueo? –
¿Puedes agregar los valores para 'event'? Podría ser una mala clave? –
aquí publiqué el registro de bloqueo :) –