Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. static void * const MyClassKVOContext = (void*)&MyClassKVOContext; // unique context
  2.  
  3. -(void)awakeFromNib
  4. {
  5. [super awakeFromNib];
  6. [self registerAsLocationListener];
  7. }
  8.  
  9.  
  10. -(void)registerAsLocationListener
  11. {
  12. if ([self.reuseIdentifier isEqualToString:@"locationcell1"])
  13. {
  14. [[RA_LocationSingleton locationSingleton]
  15. addObserver:self
  16. forKeyPath:@"currentLocation"
  17. options:NSKeyValueObservingOptionNew
  18. context:MyClassKVOContext];
  19.  
  20. NSLog(@"Registered for currentLocation");
  21. NSLog(@"self.description: %@", [self description]);
  22. }
  23. }
  24.  
  25.  
  26. -(void)dealloc
  27. {
  28. if ([self.reuseIdentifier isEqualToString:@"locationcell1"])
  29. {
  30. NSLog(@"Attempting to deregister");
  31. NSlog(@"self.description: %@", [self description]);
  32.  
  33. [self removeObserver:self
  34. forKeyPath:@"currentLocation"
  35. context:MyClassKVOContext];
  36. }
  37.  
  38. // [super dealloc]; called automatically, using ARC
  39. }
  40.  
  41. // load view
  42. 2014-09-01 14:27:33.704 Rally[2931:60b] Registered for currentLocation
  43. 2014-09-01 14:27:33.705 Rally[2931:60b] self.description: <CustomCell: 0x9afa570; baseClass = UITableViewCell; frame = (0 0; 320 44); autoresize = RM+BM; layer = <CALayer: 0x9afa710>>
  44.  
  45. // exit from view
  46. 2014-09-01 14:27:40.867 Rally[2931:60b] Attempting to deregister
  47. 2014-09-01 14:27:40.868 Rally[2931:60b] self.description: <CustomCell: 0x9afa570; baseClass = UITableViewCell; frame = (0 231; 320 44); autoresize = W; layer = <CALayer: 0x9afa710>>
  48. 2014-09-01 14:27:40.870 Rally[2931:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <CustomCell 0x9afa570> for the key path "currentLocation" from <CustomCell 0x9afa570> because it is not registered as an observer.'
  49. *** First throw call stack:
  50. (
  51. 0 CoreFoundation 0x026761e4 __exceptionPreprocess + 180
  52. 1 libobjc.A.dylib 0x023f58e5 objc_exception_throw + 44
  53. 2 CoreFoundation 0x02675fbb +[NSException raise:format:] + 139
  54. 3 Foundation 0x0204346d -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 538
  55. 4 Foundation 0x020431f4 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 105
  56. 5 Foundation 0x02043118 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] + 172
  57. 6 Rally 0x00005ac1 -[CustomCell dealloc] + 353
  58. 7 UIKit 0x01107b94 -[UIView release] + 89
  59. 8 CoreFoundation 0x025f7bf0 CFRelease + 272
  60. 9 CoreFoundation 0x0261716e -[__NSArrayM dealloc] + 142
  61. 10 libobjc.A.dylib 0x02406692 _ZN11objc_object17sidetable_releaseEb + 268
  62. 11 libobjc.A.dylib 0x02405e81 objc_release + 49
  63. 12 libobjc.A.dylib 0x02406ce7 _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 537
  64. 13 CoreFoundation 0x02617878 _CFAutoreleasePoolPop + 24
  65. 14 CoreFoundation 0x0261c5d3 __CFRunLoopRun + 1971
  66. 15 CoreFoundation 0x0261b9d3 CFRunLoopRunSpecific + 467
  67. 16 CoreFoundation 0x0261b7eb CFRunLoopRunInMode + 123
  68. 17 GraphicsServices 0x036f85ee GSEventRunModal + 192
  69. 18 GraphicsServices 0x036f842b GSEventRun + 104
  70. 19 UIKit 0x010b5f9b UIApplicationMain + 1225
  71. 20 Rally 0x00006a6d main + 141
  72. 21 libdyld.dylib 0x02ef6701 start + 1
  73. )
  74. libc++abi.dylib: terminating with uncaught exception of type NSException
  75. (lldb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement