Crash free Realm use with RxSwift.
Realm crashed.
App crashed due to libc++abi.dylib: terminating with uncaught exception of type realm::LogicError: Bad version number.
The most relevant stack trace:
#0 0x0000000102097c3c in ObservableType.(bindTo(Variable<A.E>) -> Disposable).(closure #1) at /Users/Colin/Developer/learner-ios/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift:52
#1 0x0000000102308cb4 in ObservableType.(subscribe((Event<A.E>) -> ()) -> Disposable).(closure #1) at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift:21
#2 0x00000001022899d4 in AnonymousObserver.onCore(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift:26
#3 0x000000010230f7ec in ObserverBase.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift:28
#4 0x000000010230fb44 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A> ObserverBase<A> ()
#5 0x000000010234aba4 in Sink.forwardOn(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift:29
#6 0x00000001022f2e3c in MapSink.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift:39
#7 0x00000001022f32bc in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A, B where ...> MapSink<A, B> ()
#8 0x000000010234aba4 in Sink.forwardOn(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift:29
#9 0x0000000102288b78 in AnonymousObservableSink.on(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift:31
#10 0x0000000102288e78 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A where ...> AnonymousObservableSink<A> ()
#11 0x000000010228ad9c in partial apply ()
#12 0x000000010228a1f8 in AnyObserver.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/AnyObserver.swift:41
#13 0x000000010228a314 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A> AnyObserver<A> ()
#14 0x000000010228ad9c in partial apply ()
#15 0x000000010228a1f8 in AnyObserver.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/AnyObserver.swift:41
#16 0x000000010228a314 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A> AnyObserver<A> ()
#17 0x000000010228c3c0 in Bag<A where ...>.on(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift:20
#18 0x0000000102316b58 in PublishSubject.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift:52
#19 0x0000000102318d74 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A> PublishSubject<A> ()
#20 0x000000010234aba4 in Sink.forwardOn(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift:29
#21 0x00000001022f2e3c in MapSink.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Map.swift:39
#22 0x00000001022f32bc in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A, B where ...> MapSink<A, B> ()
#23 0x000000010234aba4 in Sink.forwardOn(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/Sink.swift:29
#24 0x0000000102288b78 in AnonymousObservableSink.on(Event<A.E>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/Observables/Implementations/AnonymousObservable.swift:31
#25 0x0000000102288e78 in protocol witness for ObserverType.on(Event<A.E>) -> () in conformance <A where ...> AnonymousObservableSink<A> ()
#26 0x000000010228ad9c in partial apply ()
#27 0x000000010228a1f8 in AnyObserver.on(Event<A>) -> () at /Users/Colin/Developer/learner-ios/Pods/RxSwift/RxSwift/AnyObserver.swift:41
#28 0x0000000100085120 in URLSession.(observableResponse(URLRequest) -> Observable<(Data, HTTPURLResponse, Double)>).(closure #1).(closure #1) at /Users/Colin/Developer/learner-ios/learner-ios/Network/URLSession+Learner.swift:52
Never seen this before. Unable to determine how it crashed. It does not really follow a reproducible procedure, but often after a series of add and remove realm operations.
Cannot find the specific place it crashed, since Rx has complicated stuff quite a bit. Project is not open-source.
Realm version: 2.2.0
Xcode version: 8.3.1
iOS/OSX version: iOS 10.2
Dependency manager + version: CocoaPods 1.1.1
Thank you for reporting this issue @tzm41, but unfortunately without any reproducible case it's very hard to figure it out what is going on there and suggest anything.
Please let us know if you're able to reproduce it or if you have any other details about this crash.
/cc @finnschiermer
Probably related to https://github.com/realm/realm-cocoa/issues/4422
This is happening to us as well. But we can't find a sure way to reproduce it.
The TestFlight version of our app has not encountered this crash yet. Weird enough.
We look forward to having more information on how to reproduce this so we can start investigating.
I now have a semi-consistent repro case for this (which was actually trying to reproduce something completely different...).
This should be fixed by https://github.com/realm/realm-object-store/pull/355.
I'm having that error also, can't really say how to reproduce, but today got it while debugging.

The fix for this was released in 2.4.
it resurfaced in Realm-Java 3.0.0 which is built on top of new Object Store version, so maybe it can still occur due to other causes https://github.com/realm/realm-java/issues/4369
Most helpful comment
This should be fixed by https://github.com/realm/realm-object-store/pull/355.