gpt4 book ai didi

iOS 10 [CFString 发布] : message sent to deallocated instance

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:56:36 25 4
gpt4 key购买 nike

最近,我将我的 iPhone 升级到 iOS 10。我在 iPhone 上安装了我的应用程序后,我发现当我在我的应用程序中点击一个 tableView 时,它肯定会崩溃。我在方法 cellForRowAtIndexPath 中做了一些断点,并在 Diagnostics 表中选择了 Zombie Objects。但是消息[CFString release]: message sent to deallocated instance 0x17063b960总是出现在Debug区。此问题仅出现在 iOS 10 Beta 上,我不确定是否是 iOS 10 Beta 引起的问题。有没有人像我一样遇到这个问题?我将不胜感激。

更新:

当它返回cell时,崩溃会出现:Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) and Thread 1: signal SIGKILL

相关代码如下所示:

UITableViewCell *单元格;

HKLoadingModel * model = [self modelForTableView:tableView];
ShopServiceType type = model == self.carwashLoadingModel ? ShopServiceCarWash : ShopServiceCarwashWithHeart;
JTShop *shop = [model.datasource safetyObjectAtIndex:indexPath.section];
NSArray * serviceArray = [self filterShopServiceByType:type andArray:shop.shopServiceArray];
NSInteger serviceAmount = serviceArray.count;
NSInteger sectionAmount = 1 + serviceAmount + 1;

if(indexPath.row == 0)
{
cell = [self tableView:tableView shopTitleCellAtIndexPath:indexPath];
}
else if (indexPath.row == sectionAmount - 1)
{
cell = [self tableView:tableView shopNavigationCellAtIndexPath:indexPath];
}
else
{
cell = [self tableView:tableView shopServiceCellAtIndexPath:indexPath andShopService:serviceArray];
}

return cell;

最佳答案

尝试使用 Instruments 工具来跟踪您将消息传递到已释放实例的位置。苹果有good guide为此:

  1. Launch Instruments.
  2. In the profiling template selection dialog that appears, click Zombies.
  3. Choose your device and app from the target device and process lists.
  4. Click Choose to create a trace document.
  5. Click the Record button in the toolbar (or press Command-R) to begin recording.
  6. Use your app normally.
  7. If a call is made to a deallocated object, a flag is inserted in the timeline pane and a Zombie Messaged dialog appears, indicating that a message was sent to a deallocated object at a specific memory address.
  8. If you close the Zombie Messaged dialog, you can reopen it by clicking the flag.
  9. Click the focus arrow next to the zombie’s memory address to display the memory history of the zombie object in the detail pane, along with corresponding reference counts and method calls.
  10. Select the Zombie event (or any other event you want to investigate) in the detail pane.
  11. Press Command-3 to display a stack trace for the selected event in the extended detail area of the inspector.
  12. Click the Collapse button in the extended detail area to hide system calls in the stack trace. This makes it easier to locate your app’s methods.
  13. Calls made by your app are colored black and preceded by a user code icon.
  14. Double-click a method in the stack trace to display its code in Instruments.
  15. Click the Xcode button at the top of the detail pane to open the code in Xcode for editing.

在我的例子中,崩溃是由 FoundationExtension pod 版本 0.59 引起的。一旦我删除它,我就不再崩溃了。

关于iOS 10 [CFString 发布] : message sent to deallocated instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38144618/

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