Evgeniy Kleban
Evgeniy Kleban

Reputation: 6975

App crash using Realm Swift

I have send my app for test, and with crashlytics i found crash log. I don't know what i can tell about my app, it simple table view that populate data from Realm, thats simply as that. Please look at crash log:

Fatal Exception: Invalid value
0  CoreFoundation                 0x188efafd8 __exceptionPreprocess
1  libobjc.A.dylib                0x18795c538 objc_exception_throw
2  Realm                          0x1006ba570 RLMPrecondition(bool, NSString*, NSString*, ...) (RLMQueryUtil.mm:67)
3  Realm                          0x1007026b8 (anonymous namespace)::validate_property_value((anonymous namespace)::ColumnReference const&, objc_object*, NSString*, RLMObjectSchema*, NSString*) (RLMQueryUtil.mm:1071)
4  Realm                          0x1006bca28 (anonymous namespace)::QueryBuilder::apply_value_expression(RLMObjectSchema*, NSString*, objc_object*, NSComparisonPredicate*) (RLMQueryUtil.mm:1250)
5  Realm                          0x1006bb0d0 (anonymous namespace)::QueryBuilder::apply_predicate(NSPredicate*, RLMObjectSchema*) (RLMQueryUtil.mm:1452)
6  Realm                          0x1006ba62c RLMPredicateToQuery(NSPredicate*, RLMObjectSchema*, RLMSchema*, realm::Group&) (RLMQueryUtil.mm:504)
7  Realm                          0x10071c7f8 -[RLMResults objectsWithPredicate:] (RLMResults.mm:329)
8  RealmSwift                     0x100cf4c28 specialized Results.filter(String, [Any]...) -> Results<A> (Results.swift:208)
9  RealmSwift                     0x100cf212c Results.filter(String, [Any]...) -> Results<A> (Results.swift)
10 MyApp                          0x1000fbffc specialized ProductViewModel.init(m : Any, loginText : String, onAccountString : String, comissionString : String, fromClientString : String, commentString : String, amountVal : String, status : ProductResultItem.ResultStatus, errorTxt : String?, transId : Int?, shouldHideBackBtn : Bool, shouldAddModel : Bool, shouldModifyOperationWithId : Bool) -> ProductViewModel (ProductViewModel.swift:82)
11 MyApp                          0x1000da934 specialized ProductViewController.(simpleBtnCellTapped(type : SimpleBtnItem.ButtonType) -> ()).(closure #2) (ProductViewController.swift:249)
12 MyApp                          0x1000dcc4c partial apply for ProductViewController.(enterBtnLongTapEnteredText(enteredTxt : String) -> ()).(closure #1)
13 MyApp                          0x1000f5e74 ProductViewModel.(proceedTransfer(transactionResult : (ProductResultItem.ResultStatus, String?, Int?) -> ()) -> ()).(closure #1) empty-list Bool (ProductViewModel.swift:433)
14 MyApp                          0x1000e2388 ApiManager.(createOperation(parameters : [String : Any], complete : (Bool, String?) -> ()) -> ()).(closure #1) (ApiManager.swift:207)
15 Alamofire                      0x10037b944 specialized DataRequest.(response<A where ...> (queue : DispatchQueue?, responseSerializer : A, completionHandler : (DataResponse<A.SerializedObject>) -> ()) -> Self).(closure #1).(closure #1) (ResponseSerialization.swift:167)
16 Alamofire                      0x10035f5f4 thunk (NetworkReachabilityManager.swift)
17 libdispatch.dylib              0x187db29e0 _dispatch_call_block_and_release
18 libdispatch.dylib              0x187db29a0 _dispatch_client_callout
19 libdispatch.dylib              0x187db75e8 _dispatch_main_queue_callback_4CF
20 CoreFoundation                 0x188ea90c0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
21 CoreFoundation                 0x188ea6cdc __CFRunLoopRun
22 CoreFoundation                 0x188dd6d94 CFRunLoopRunSpecific
23 GraphicsServices               0x18a840074 GSEventRunModal
24 UIKit                          0x18f08f130 UIApplicationMain
25 MyApp                          0x1000668b8 main (AppDelegate.swift:18)
26 libdyld.dylib                  0x187de559c start

Where i suppose to find what cause that error?

Upvotes: 0

Views: 700

Answers (1)

bdash
bdash

Reputation: 18308

Errors raised from within Realm's validate_property_value method indicate that a value that's being compared in a predicate is not of a type that is compatible with the property it is being compared with.

The exception's message, which is typically included in the crash log, should tell you precisely which property and and object are the problem. If you don't have that information, you should take a close look at the code performing the querying (ProductViewModel.init) and see if you can determine where the inappropriate object type is coming from.

Upvotes: 2

Related Questions