gpt4 book ai didi

ios - __NSPlaceholderDictionary initWithObjects :forKeys:count: crash

转载 作者:行者123 更新时间:2023-11-29 11:49:09 25 4
gpt4 key购买 nike

我有以下代码:

queryParams = @{@"geo_location" : [GlobalData sharedGlobalData].latLong, @"sale_ids": selectedSaleId};

它有时会在实时应用程序上崩溃,但我们无法重现崩溃。我一直在尝试分析报告并了解崩溃的可能原因,但我没有成功。

我需要一些帮助来理解在什么情况下会发生以下崩溃:

1 __exceptionPreprocess + 1245624
2 libobjc.A.dylib objc_exception_throw + 34136
3 CoreFoundation -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 81576
4 CoreFoundation +[NSDictionary dictionaryWithObjects:forKeys:count:] + 81176
5 MyApp -[SaleViewController loadStores] (SaleViewController.m:378)
6 MyApp -[SaleViewController viewDidLoad](SaleViewController.m:158)
7 UIKit -[UIViewController loadViewIfRequired] + 63776
8 UIKit -[UIViewController __viewWillAppear:] + 160944
9 UIKit -[UINavigationController _startCustomTransition:] + 1766832
10 UIKit -[UINavigationController _startDeferredTransitionIfNeeded:] + 818800
11 UIKit -[UINavigationController __viewWillLayoutSubviews] + 817880

最佳答案

这就是当放置在集合中的值之一为 nil 时崩溃的样子。您可以使用条件来防御此崩溃:

if ([GlobalData sharedGlobalData].latLong && selectedSaleId) {
queryParams = @{@"geo_location" : [GlobalData sharedGlobalData].latLong, @"sale_ids": selectedSaleId};
}

要么,要么手头的调试任务是找出为什么这两个值都为零。

关于ios - __NSPlaceholderDictionary initWithObjects :forKeys:count: crash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42027736/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com