Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SudoPlz opened this issue Feb 6, 2018 · 6 comments

Comments

@SudoPlz
Copy link

SudoPlz commented Feb 6, 2018

Hey there.

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

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

@yannickl
Copy link
Owner

yannickl commented Feb 6, 2018

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

@SudoPlz
Copy link
Author

SudoPlz commented Feb 6, 2018

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];
}

@yannickl
Copy link
Owner

yannickl commented Feb 6, 2018

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

@SudoPlz
Copy link
Author

SudoPlz commented Feb 6, 2018

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

@strictlyd
Copy link
Contributor

Is it reproducible?

@SudoPlz
Copy link
Author

SudoPlz commented Feb 6, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants