yannickl / YLMoment

Parsing, validating, manipulating, and formatting dates easily in Objective-C (API inspired by moment.js)

Home Page:http://yannickl.github.io/YLMoment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NSRangeException Cannot remove an observer for the key path "locale" from <YLMoment> because it is not registered as an observer.

SudoPlz opened this issue · comments

Hey there.

Not sure why this happens, but I received that crash today.

[self removeObserver:self forKeyPath:@"locale"];

That's strange. Do you have the crash log?

Sure there you go:

NSRangeException Cannot remove an observer <YLMoment 0x1c4483c50> for the key path "locale" from <YLMoment 0x1c4483c50> because it is not registered as an observer. 
    Frameworks/CoreFoundation.framework/CoreFoundation ___exceptionPreprocess
    /usr/lib/libobjc.A.dylib _objc_exception_throw
    Frameworks/CoreFoundation.framework/CoreFoundation +[NSException raise:format:]
    Frameworks/Foundation.framework/Foundation -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:]
    Frameworks/Foundation.framework/Foundation -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
    Frameworks/YLMoment.framework/YLMoment -[YLMoment dealloc]
    Frameworks/Foundation.framework/Foundation _NSKVODeallocate
    ExampleApp/Calendar/RCTACCalendar.m:1208:5 -[RCTACCalendar getDateTimeFromProps:]
    ExampleApp/Calendar/RCTACCalendar.m:1110:26 -[RCTACCalendar getDataForRowIndex:]
    ExampleApp/Calendar/RCTACCalendar.m:485:7 -[RCTACCalendar bindRowView:toRowIndex:]
    ExampleApp/Calendar/RCTACCalendar.m:599:11 __50-[RCTACCalendar recenterToItemWithIndex:animated:]_block_invoke_2
    /usr/lib/system/libdispatch.dylib __dispatch_call_block_and_release
    /usr/lib/system/libdispatch.dylib __dispatch_client_callout
    /usr/lib/system/libdispatch.dylib __dispatch_main_queue_callback_4CF$VARIANT$mp
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
    Frameworks/CoreFoundation.framework/CoreFoundation ___CFRunLoopRun
    Frameworks/CoreFoundation.framework/CoreFoundation _CFRunLoopRunSpecific
    PrivateFrameworks/GraphicsServices.framework/GraphicsServices _GSEventRunModal
    Frameworks/UIKit.framework/UIKit _UIApplicationMain
    ExampleApp/main.m:16:12 main
    /usr/lib/system/libdyld.dylib _start

Not sure if that helps.

This is the only place were I use YLMoment in that function (getDateTimeFromProps):

YLMoment* datetimeMom = [[YLMoment momentWithDate:_centerDateTimeMom.date] addAmountOfTime:dayCnt forUnitKey:@"days"];
if (datetimeMom) {
    return [datetimeMom format];
}

Really strange. I don't know why it raises this error because the momentInitiated should be called...

Yeah, I don't really understand why that happened either.

Is it reproducible?

Nope, I have no idea how to reproduce that. I received the stacktrace through Bugsnag from a client's device in production.