gpt4 book ai didi

ios - 我无法理解崩溃。

转载 作者:行者123 更新时间:2023-12-02 04:00:03 27 4
gpt4 key购买 nike

我因 crashlytics 而崩溃。可能它与weakSelf有关。

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x000000000defe

0 libobjc.A.dylib 0x224aea44 _objc_trap()
1 libobjc.A.dylib 0x224aeaa9 _objc_inform + 70
2 libobjc.A.dylib 0x224c8413 weak_register_no_lock + 210
3 libobjc.A.dylib 0x224c8993 objc_initWeak + 130
4 GPS_______appLite 0xd77b1 -[ModuleView observeValueForKeyPath:ofObject:change:context:] (ModuleView.m:232)
5 GPS_______appLite 0xd9287 -[ModuleSpeedometerView observeValueForKeyPath:ofObject:change:context:] (ModuleSpeedometerView.m:198)
6 Foundation 0x2349aa91 NSKVONotify + 52
7 Foundation 0x23479bef NSKeyValueNotifyObserver + 286
8 Foundation 0x23479847 NSKeyValueDidChange + 346
9 Foundation 0x23466599 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 96
10 GPS_______appLite 0x12c393 -[GPSTracker private_updateCurrentStatisticsWithLocation:] (GPSTracker.mm:1887)
11 GPS_______appLite 0x12c1b9 -[GPSTracker private_addLocationToHistory:] (GPSTracker.mm:1870)
12 GPS_______appLite 0x12c6af -[GPSTracker private_processNewLocation:fromManager:] (GPSTracker.mm:1938)
13 GPS_______appLite 0x12c88b -[GPSTracker locationManager:didUpdateLocations:] (GPSTracker.mm:1953)
14 CoreLocation 0x28c5c493 (null) + 25830
15 CoreLocation 0x28c5765b (null) + 5806
16 CoreLocation 0x28c50725 (null) + 988
17 CoreFoundation 0x22cd5d91 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x22cd584d __CFRunLoopDoBlocks + 216
19 CoreFoundation 0x22cd41bf __CFRunLoopRun + 1806
20 CoreFoundation 0x22c232e9 CFRunLoopRunSpecific + 520
21 CoreFoundation 0x22c230d5 CFRunLoopRunInMode + 108
22 GraphicsServices 0x24213ac9 GSEventRunModal + 160
23 UIKit 0x272e80b9 UIApplicationMain + 144
24 GPS_______appLite 0x10adc7 main (main.m:15)
25 libdispatch.dylib 0x228cb873 (Missing)

和代码

//ModuleView class
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
if ([object isKindOfClass:[GPSTracker class]])
{
__weak GPSTracker *tracker = (GPSTracker *)object;
__weak __typeof__(self) weakSelf = self;

dispatch_async(dispatch_get_main_queue(), ^{
if ([keyPath isEqualToString:NSStringFromSelector(@selector(trackerMode))])
{
[weakSelf trackerStateChanged];
}
else if ([keyPath isEqualToString:NSStringFromSelector(@selector(currentStatistics))])
{
id oldValue = [change objectForKey:NSKeyValueChangeOldKey];
if (!oldValue
|| [oldValue isKindOfClass:[NSNull class]])
{
// If statistics instance has been initialized
if (!weakSelf.shouldIgnoreUpdates)
{
[tracker.currentStatistics.time addUniqueObserver:weakSelf
forKeyPath:NSStringFromSelector(@selector(elapsed))
options:NSKeyValueObservingOptionNew];
}
}

[weakSelf trackerUpdate];
}
});
}
else if ([object isKindOfClass:[GPSTrackerTimeStatistics class]])
{
__weak __typeof__(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf timerUpdate];
});
}
}

最佳答案

对于发布版本,您可以看到崩溃和代码行,

在 xCode 中:窗口 -> 管理器 -> 崩溃

然后从左侧面板中选择应用程序和版本

尝试“异常断点”

异常断点自动在导致崩溃的行添加断点,可以看到问题

添加异常断点:

在 xCode 中:顶部菜单 -> 调试 -> 断点 -> 创建异常断点...

然后再次运行

关于ios - 我无法理解崩溃。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36985146/

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