首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Realm Swift时应用程序崩溃

使用Realm Swift时应用程序崩溃
EN

Stack Overflow用户
提问于 2017-11-15 13:55:15
回答 1查看 466关注 0票数 0

我已经发送了我的应用程序进行测试,并与crashlytics我发现崩溃日志。我不知道我的应用程序能告诉我什么,它是一个简单的表视图,从Realm中填充数据,就这么简单。请查看崩溃日志:

代码语言:javascript
复制
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

我应该在哪里找到导致这个错误的原因?

EN

回答 1

Stack Overflow用户

发布于 2017-11-15 14:12:46

从Realm的validate_property_value方法中引发的错误表明,在谓词中比较的值的类型与要比较的属性不兼容。

异常的消息通常包含在崩溃日志中,它应该准确地告诉您问题出在哪个属性和对象上。如果您没有这些信息,那么您应该仔细查看执行查询的代码(ProductViewModel.init),看看是否可以确定不适当的对象类型来自何处。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47300327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档