gpt4 book ai didi

ios - NSRangeException,但是在哪里呢?

转载 作者:行者123 更新时间:2023-12-02 23:41:47 25 4
gpt4 key购买 nike

我有一个应用程序,用户报告该应用程序随机崩溃。所有崩溃都有相同的堆栈

0   CoreFoundation  TAGPBIvarClearUInt32 (in SPONTAN) + 11  
1 libobjc.A.dylib _mh_execute_header (in SPONTAN) + 15567
2 CoreFoundation TAGPBIvarClearSFixed64 (in SPONTAN) + 13
3 Foundation -[AdvancedPriceViewController newAP:] (in SPONTAN) (AdvancedPriceViewController.m:68) + 110325
4 SPONTAN +[TrStart isJSONTrStart:] (in SPONTAN) + 77
5 SPONTAN __65-[MintRequestWorker processPreviousLoggedRequestsAsyncWithBlock:]_block_invoke_2 (in SPONTAN) + 397
6 SPONTAN __58-[FileRepository readLoggedExceptionsWithCompletionBlock:]_block_invoke (in SPONTAN) + 281
7 libdispatch.dylib _mh_execute_header (in SPONTAN) + 6195
8 libdispatch.dylib -[FirstViewController viewDidLoad] (in SPONTAN) (FirstViewController.m:56) + 84257
9 libdispatch.dylib -[FirstViewController viewDidAppear:] (in SPONTAN) (FirstViewController.m:80) + 84769
10 libsystem_pthread.dylib _mh_execute_header (in SPONTAN) + 3027
11 libsystem_pthread.dylib _mh_execute_header (in SPONTAN) + 2712

这可能看起来不错,但是当我查看第 3、8 和 9 级时,代码就不再有意义了。

3   Foundation  -[AdvancedPriceViewController newAP:] (in SPONTAN) (AdvancedPriceViewController.m:68) + 110325  
Line 68: NSMutableArray *arrayOfIndexPaths = [[NSMutableArray alloc] init];

8 libdispatch.dylib -[FirstViewController viewDidLoad] (in SPONTAN) (FirstViewController.m:56) + 84257
Line 56: [[SelectCity titleLabel] setFont:[UIFont fontWithName:@"Avenir" size:15]];

9 libdispatch.dylib -[FirstViewController viewDidAppear:] (in SPONTAN) (FirstViewController.m:80) + 84769
Line 80: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

错误是 NSRangeException

*** -[__NSCFConstantString substringToIndex:]: Index 2147483647 out of bounds; string length 0

谁能告诉我这是怎么回事?

最佳答案

在源中搜索选择器 substringToIndex: 的用法。我不熟悉 AdvancedPriceViewController 类;如果是您的,您可能会在 [AdvancedPriceViewController newAP:] 中找到 substringToIndex:,您在其中使用 构造了一个 NSRange 对象>-1。当 -1 转换为 uint32 时,它将显示为 2147483647MAX_INT

关于ios - NSRangeException,但是在哪里呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26465324/

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