gpt4 book ai didi

ios - 获取 "malloc: *** error: incorrect checksum for freed object"不一致

转载 作者:行者123 更新时间:2023-11-28 19:04:32 25 4
gpt4 key购买 nike

完整的错误是:

app(85540,0x38661a8) malloc: *** error for object 0x11214f84: 
incorrect checksum for freed object - object was probably modified after being freed.

所以我得到了一些很难复制的东西,我怀疑这与我设置 block 的方式有关。我想要获取的是 Xbox Live 上游戏玩家的当前在线状态,因此我在 viewDidLoad 中分配了 2 个 NSMutuableDictionariesonlinePlayers 用于保存玩家的在线状态值,因此在上下滚动时不会在 cellForRowAtIndexPath 中反复检查。 checkedPlayers 是为了防止多次调用试图获取同一播放器的状态。无论如何,如果我一遍又一遍地启动模拟器,29/30 次启动会很好,但是当我尝试为游戏玩家设置在线状态值时,它总是在启动时至少崩溃一次并出现上述错误:

        NSString* gamertag = cell.gamerTagLabel.text;
if (![_checkedPlayers containsObject:gamertag]) {
[_checkedPlayers addObject:gamertag];
[Utilities processJSONDataWithGamertag:gamertag andBlock:^(NSData *jsonData) {
id onlineStatus;
NSDictionary *allXboxAttributes = [Utilities returnJSONObject:jsonData];
// Get current Xbox Live Data
if ([allXboxAttributes objectForKey:@"data"]) {
NSDictionary *dataXboxAttributes = [allXboxAttributes objectForKey:@"data"];
onlineStatus = [dataXboxAttributes objectForKey:@"online"];

// Crashes on the line below
[_onlinePlayers setObject:onlineStatus forKey:gamertag];

// Return to main thread and update online status
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}];
}

如果出于某种原因有帮助,从 dataXboxAttributes 返回的值是一个 BOOL。任何帮助将非常感激。谢谢!

最佳答案

您在该方法中遇到错误,但问题可能出在其他地方。

要找到问题的根源,请在 XCode 中转到 Product > Scheme > Edit Scheme,然后在 Diagnostics 选项卡下启用所有 Malloc 设置和 Guard Malloc。

这样,再次运行您的应用程序,XCode 将停在导致问题的那一行。

Scheme definition

关于ios - 获取 "malloc: *** error: incorrect checksum for freed object"不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21718389/

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