系统iOS 8.x, ARC。

CrashCase:

在UIViewController中有一个类型为UIScrollView的实例变量scrollView,

点击UIViewController中的某个按钮时调用"[self.navigationController popViewControllerAnimated:NO];",

在这之后该UIViewController的dealloc方法已被调用。在dealloc方法调用之后,scrollView其实还被系统View Tree

所持有,scrollView会访问其delegate,此时发生Crash。(UIScrollView的delegate)

在Debug时,

console会输出:"-[DSViewController respondsToSelector:]: message sent to deallocated instance 0x7ff3f6291160"

stack如图:

看第二frame: [UIScrollView _getDelegateZoomView], 执行停在line 18。

 UIKit`-[UIScrollView _getDelegateZoomView]:
0x110dd48cd: pushq %rbp
0x110dd48ce: movq %rsp, %rbp
0x110dd48d1: pushq %r15
0x110dd48d3: pushq %r14
0x110dd48d5: pushq %rbx
0x110dd48d6: pushq %rax
0x110dd48d7: movq %rdi, %r14
0x110dd48da: movq 0xd344ef(%rip), %rax ; UIScrollView._zoomView
0x110dd48e1: movq (%r14,%rax), %rbx
0x110dd48e5: testq %rbx, %rbx
0x110dd48e8: jne 0x110dd497b ; -[UIScrollView _getDelegateZoomView] + 174
0x110dd48ee: movq 0xd344c3(%rip), %r15 ; UIScrollView._delegate
0x110dd48f5: movq (%r14,%r15), %rdi
0x110dd48f9: movq 0xd08228(%rip), %rdx ; "viewForZoomingInScrollView:"
0x110dd4900: movq 0xd02df9(%rip), %rsi ; "respondsToSelector:"
0x110dd4907: callq *0xac2783(%rip) ; (void *)0x00000001124b8000: objc_msgSend
0x110dd490d: xorl %ebx, %ebx
0x110dd490f: testb %al, %al
0x110dd4911: je 0x110dd497b ; -[UIScrollView _getDelegateZoomView] + 174
0x110dd4913: movq (%r14,%r15), %rdi
0x110dd4917: movq 0xd0820a(%rip), %rsi ; "viewForZoomingInScrollView:"
0x110dd491e: movq %r14, %rdx
0x110dd4921: callq *0xac2769(%rip) ; (void *)0x00000001124b8000: objc_msgSend
0x110dd4927: movq %rax, %rbx
0x110dd492a: leaq 0xd6bcdb(%rip), %rax ; _UIApplicationLinkedOnVersion
0x110dd4931: movl (%rax), %eax
0x110dd4933: testl %eax, %eax
0x110dd4935: je 0x110dd4941 ; -[UIScrollView _getDelegateZoomView] + 116
0x110dd4937: cmpl $0x4ffff, %eax
0x110dd493c: seta %al
0x110dd493f: jmp 0x110dd494b ; -[UIScrollView _getDelegateZoomView] + 126
0x110dd4941: movl $0x50000, %edi
0x110dd4946: callq 0x110d4b41f ; _UIApplicationLinkedOnOrAfter
0x110dd494b: testb %al, %al
0x110dd494d: je 0x110dd497b ; -[UIScrollView _getDelegateZoomView] + 174
0x110dd494f: cmpq %r14, %rbx
0x110dd4952: jne 0x110dd497b ; -[UIScrollView _getDelegateZoomView] + 174
0x110dd4954: movq 0xd2e5ad(%rip), %rdi ; (void *)0x00000001109c2458: NSException
0x110dd495b: movq 0xac1866(%rip), %rax ; (void *)0x000000011098aa10: NSGenericException
0x110dd4962: movq (%rax), %rdx
0x110dd4965: movq 0xd0487c(%rip), %rsi ; "raise:format:"
0x110dd496c: leaq 0xb06a3d(%rip), %rcx ; @"The view returned from viewForZoomingInScrollView: must be a subview of the scroll view. It can not be the scroll view itself."
0x110dd4973: xorl %eax, %eax
0x110dd4975: callq *0xac2715(%rip) ; (void *)0x00000001124b8000: objc_msgSend
0x110dd497b: movq %rbx, %rax
0x110dd497e: addq $0x8, %rsp
0x110dd4982: popq %rbx
0x110dd4983: popq %r14
0x110dd4985: popq %r15
0x110dd4987: popq %rbp
0x110dd4988: retq

解决方法:

DSViewController的dealloc中将添加: "scrollView.delegate = nil;"

Q1: 在iOS 7.x中没有Crash,这是不是iOS 8.x的系统bug?


Reference

1. UIScrollView internal consistency crash

http://stackoverflow.com/questions/26103756/uiscrollview-internal-consistency-crash

2. popToRootViewController crashes when tableView is still scrolling

http://stackoverflow.com/questions/26060727/poptorootviewcontroller-crashes-when-tableview-is-still-scrolling

iOS.Crash.OniOS8.WhenCall[popToRootViewController]的更多相关文章

  1. iOS --------Crash 分析(一)

    iOS Crash 分析(文一)- 开始 1. 名词解释 1. UUID 一个字符串,在iOS上每个可执行文件或库文件都包含至少一个UUID.目的是为了唯一识别这个文件. 2. dwarfdump 苹 ...

  2. iOS: Crash文件解析(一)

    iOS Crash文件的解析(一) 开发程序的过程中不管我们已经如何小心,总是会在不经意间遇到程序闪退.脑补一下当你在一群人面前自信的拿着你的App做功能预演的时候,流畅的操作被无情地Crash打断. ...

  3. 漫谈iOS Crash收集框架

    漫谈iOS Crash收集框架   Crash日志收集 为了能够第一时间发现程序问题,应用程序需要实现自己的崩溃日志收集服务,成熟的开源项目很多,如 KSCrash,plcrashreporter,C ...

  4. IOS Crash捕获

    IOS Crash ,就两种情况:一种是异常,另一种是中断[信号量]. #include <libkern/OSAtomic.h> #include <execinfo.h> ...

  5. iOS Crash文件的解析

    iOS Crash文件的解析 开发程序的过程中不管我们已经如何小心,总是会在不经意间遇到程序闪退.脑补一下当你在一群人面前自信的拿着你的App做功能预演的时候,流畅的操作被无情地Crash打断.联想起 ...

  6. iOS crash日志分析

    iOS crash日志分析 一. 寻找crash文件:手机崩溃后的ips或者crash文件(ips文件可以直接修改成crash文件,直接改后缀名就可以了),这里说下如何拿到crash文件 1. 把运行 ...

  7. 了解和分析iOS Crash

    WeTest 导读 北京时间凌晨一点,苹果一年一度的发布会如期而至.新机型的发布又会让适配相关的同学忙上一阵子啦,并且iOS Crash的问题始终伴随着移动开发者.本文将从三个阶段,由浅入深的介绍如何 ...

  8. iOS Crash 分析 符号化崩溃日志

    参考: http://blog.csdn.net/diyagoanyhacker/article/details/41247367 http://blog.csdn.net/diyagoanyhack ...

  9. iOS crash 崩溃问题的追踪方法

    http://www.cnblogs.com/easonoutlook/archive/2012/12/27/2835884.html iOS crash 崩溃问题的追踪方法 在调试程序的时候,总是碰 ...

随机推荐

  1. 问题描述: fatal error: 'XCTest/XCTest.h' file not found

    #import 解决方法:在报错的Target中的Building settings中FRAMEWORK_SEARCH_PATHS添加$(PLATFORM_DIR)/Developer/Library ...

  2. shell 脚本传参

    在 shell 中我们会见到  $0.$1.$2这样的符号,这是什么意思呢? 简单来说 $0 就是你写的shell脚本本身的名字,$1 是你给你写的shell脚本传的第一个参数,$2 是你给你写的sh ...

  3. 目前为止最全的微信小程序项目实例

    https://blog.csdn.net/zuoliangzhu/article/details/53862576#t1

  4. 如何使用eclipse创建JAVA项目并写一个简单的HelloWorld

    输入项目名称  点击完成(Finish) 原文地址:https://blog.csdn.net/qq_36798713/article/details/79530056

  5. The <classpath> or <modulepath> for <junit> must include junit.jar if not in Ant's own classpath

    The <classpath> or <modulepath> for <junit> must include junit.jar if not in Ant's ...

  6. python 进阶(转自http://python.jobbole.com/82633/)

    网络 通用 urllib -网络库(stdlib). requests -网络库. grab – 网络库(基于pycurl). pycurl – 网络库(绑定libcurl). urllib3 – P ...

  7. appium +ios 判断元素是否存在,排除visible=“false”的数据

    问题 想要判断name=xxx的元素是否存在,存在的话进行点击,结果页面并没有展示我要的元素时也提示找到了元素   原因 ios通过driver.find_element_by_name(“name值 ...

  8. 完整性约束&外键变种三种关系&数据的增删改

    完整性约束 本节重点: not null 与 default unique primary auto_increment foreign key 一.介绍 约束条件与数据类型的宽度一样,都是可选参数 ...

  9. 15种css居中方式

    1 水平居中 1.1 内联元素水平居中 利用 text-align: center 可以实现在块级元素内部的内联元素水平居中.此方法对内联元素(inline), 内联块(inline-block), ...

  10. PAT1021(dfs 连通分量)

    A graph which is connected and acyclic can be considered a tree. The height of the tree depends on t ...