• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

[复制链接]
菜鸟教程小白 发表于 2022-12-12 11:42:38 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

最近,我将我的 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时,会出现crash:Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)Thread 1: signal SIGKILL

相关代码如图所示:

UITableViewCell *cell;

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;



Best Answer-推荐答案


尝试使用 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/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap