简体   繁体   English

使用Realm Swift导致应用崩溃

[英]App crash using Realm Swift

I have send my app for test, and with crashlytics i found crash log. 我已经发送了我的应用进行测试,并使用crashlytics找到了崩溃日志。 I don't know what i can tell about my app, it simple table view that populate data from Realm, thats simply as that. 我不知道我对我的应用程序能说些什么,它是一个简单的表视图,可填充Realm中的数据,仅此而已。 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? 我应该在哪里找到导致该错误的原因?

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. 从Realm的validate_property_value方法中引发的错误表明,谓词中正在比较的值的类型与要比较的属性不兼容。

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. 如果没有这些信息,则应仔细查看执行查询的代码( ProductViewModel.init ),并查看是否可以确定不合适的对象类型来自何处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM