Cocoa touch iOS 9在显示UIActivityViewController时崩溃:[UIView\u fromWindowOrientation]发送到实例(UIView)的无法识别的选择器
只要我在iOS9上显示Cocoa touch iOS 9在显示UIActivityViewController时崩溃:[UIView\u fromWindowOrientation]发送到实例(UIView)的无法识别的选择器,cocoa-touch,ios9,uiactivityviewcontroller,unrecognized-selector,Cocoa Touch,Ios9,Uiactivityviewcontroller,Unrecognized Selector,只要我在iOS9上显示UIActivityViewController,我的应用程序就会崩溃 我已经将代码分离到以下内容:(清除了AppDelegate中的所有内容,减去将我的测试视图控制器设置为root和唯一的VC) 在“测试视图控制器打开”按钮中,点击: (我将activityVC设置为实例属性,以检查是否存在释放问题,因为其他调试工作表明activityVC可能在演示过程中被释放) 屈服 2015-09-21 11:41:55.889 App[21548:606985] *** Termi
UIActivityViewController
,我的应用程序就会崩溃
我已经将代码分离到以下内容:(清除了AppDelegate中的所有内容,减去将我的测试视图控制器设置为root和唯一的VC)
在“测试视图控制器打开”按钮中,点击:
(我将activityVC设置为实例属性,以检查是否存在释放问题,因为其他调试工作表明activityVC可能在演示过程中被释放)
屈服
2015-09-21 11:41:55.889 App[21548:606985] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView
_fromWindowOrientation]: unrecognized selector sent to instance 0x7f9168f25760'
*** First throw call stack: ( 0 CoreFoundation 0x000000010c68df65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010be08deb objc_exception_throw + 48 2 CoreFoundation 0x000000010c69658d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010c5e3f7a
___forwarding___ + 970 4 CoreFoundation 0x000000010c5e3b28 _CF_forwarding_prep_0 + 120 5 UIKit 0x000000010b104aa0 -[_UIViewControllerTransitionContext
_affineTransform] + 132 6 UIKit 0x000000010b104c77 -[_UIViewControllerTransitionContext targetTransform] + 29 7 UIKit 0x000000010b10895f -[_UIViewControllerTransitionCoordinator targetTransform] + 40 8 UIKit 0x000000010b109483 _UIViewControllerTransitionCoordinatorIsRotating + 35 9 UIKit 0x000000010a8fbcba
-[UIViewController viewWillTransitionToSize:withTransitionCoordinator:] + 78 10 UIKit 0x000000010aa5e68d __79-[UIAlertController
_contentViewControllerWillTransitionToSize:withAnimations:]_block_invoke591
+ 154 11 UIKit 0x000000010a7faeec +[UIView(Animation) performWithoutAnimation:] + 65 12 UIKit 0x000000010b03b693 -[_UIAnimationCoordinator animate] + 128 13 UIKit 0x000000010aa5e54d -[UIAlertController
_contentViewControllerWillTransitionToSize:withAnimations:] + 1071 14 UIKit 0x000000010b0d2910
-[_UIAlertControllerView _sizeOfContentViewControllerChanged] + 1009 15 UIKit 0x000000010aa5afe8
-[UIAlertController viewDidLoad] + 659 16 UIKit 0x000000010a8e0931 -[UIViewController loadViewIfRequired] + 1344 17 UIKit 0x000000010a8e0c7d
-[UIViewController view] + 27 18 UIKit 0x000000010b0292ab -[UIActivityViewController viewDidLoad] + 1266 19 UIKit 0x000000010a8e0931
-[UIViewController loadViewIfRequired] + 1344 20 UIKit 0x000000010a8e0c7d -[UIViewController view] + 27 21 UIKit 0x000000010a8fa738 -[UIViewController _setPresentationController:] + 100 22 UIKit 0x000000010a8f1cf4
-[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:]
+ 1437 23 UIKit 0x000000010a8f3970 -[UIViewController _presentViewController:withAnimationController:completion:] + 4870 24 UIKit 0x000000010a8f6878
-[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489 25 UIKit 0x000000010a8f6387
-[UIViewController presentViewController:animated:completion:] + 179 26 App 0x0000000107607734
-[YYWTFViewController wtfButtonPressed:] + 644 27 UIKit 0x000000010a7571fa -[UIApplication sendAction:to:from:forEvent:] + 92 28 UIKit 0x000000010a8bb504
-[UIControl sendAction:to:forEvent:] + 67 29 UIKit 0x000000010a8bb7d0 -[UIControl _sendActionsForEvents:withEvent:] + 311 30 UIKit 0x000000010a8ba906
-[UIControl touchesEnded:withEvent:] + 601 31 UIKit 0x000000010a7c1aa3 -[UIWindow _sendTouchesForEvent:] + 835 32 UIKit 0x000000010a7c2691 -[UIWindow sendEvent:] + 865 33 UIKit 0x000000010a774752 -[UIApplication sendEvent:] + 263 34 UIKit 0x000000010a74ffcc _UIApplicationHandleEventQueue + 6693 35 CoreFoundation 0x000000010c5ba0a1
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 36 CoreFoundation 0x000000010c5affcc
__CFRunLoopDoSources0 + 556 37 CoreFoundation 0x000000010c5af483 __CFRunLoopRun + 867 38 CoreFoundation 0x000000010c5aee98 CFRunLoopRunSpecific + 488 39 GraphicsServices 0x000000010f0d9ad2 GSEventRunModal + 161 40 UIKit 0x000000010a755676 UIApplicationMain + 171 41 App 0x000000010766101f main + 111 42 libdyld.dylib 0x000000010d98792d start + 1 )
汇编程序崩溃日志:
0x10a7555cb <+0>: pushq %rbp
0x10a7555cc <+1>: movq %rsp, %rbp
0x10a7555cf <+4>: pushq %r15
0x10a7555d1 <+6>: pushq %r14
0x10a7555d3 <+8>: pushq %r13
0x10a7555d5 <+10>: pushq %r12
0x10a7555d7 <+12>: pushq %rbx
0x10a7555d8 <+13>: pushq %rax
0x10a7555d9 <+14>: movq %rcx, %rbx
0x10a7555dc <+17>: movq %rsi, %r15
0x10a7555df <+20>: movl %edi, %r12d
0x10a7555e2 <+23>: movq 0xcc7ba7(%rip), %r13 ; (void *)0x000000010be1bd00: objc_retain
0x10a7555e9 <+30>: movq %rdx, %rdi
0x10a7555ec <+33>: callq *%r13
0x10a7555ef <+36>: movq %rax, %r14
0x10a7555f2 <+39>: movq %rbx, %rdi
0x10a7555f5 <+42>: callq *%r13
0x10a7555f8 <+45>: movq %rax, %r13
0x10a7555fb <+48>: leaq 0xcc5aea(%rip), %rbx ; _UIApplicationLinkedOnVersion
0x10a755602 <+55>: movl (%rbx), %eax
0x10a755604 <+57>: testl %eax, %eax
0x10a755606 <+59>: jne 0x10a755627 ; <+92>
0x10a755608 <+61>: cmpq $-0x1, 0xcc18a0(%rip) ; WebKitSetIsClassic + 7
0x10a755610 <+69>: je 0x10a755651 ; <+134>
0x10a755612 <+71>: leaq 0xcc1897(%rip), %rdi ; _UIApplicationLinkedOnVersionOnce
0x10a755619 <+78>: leaq 0xccaeb0(%rip), %rsi ; __block_literal_global1457
0x10a755620 <+85>: callq 0x10b1a3f5c ; symbol stub for: dispatch_once
0x10a755625 <+90>: movl (%rbx), %eax
0x10a755627 <+92>: cmpl $0x20100, %eax
0x10a75562c <+97>: jb 0x10a755651 ; <+134>
0x10a75562e <+99>: callq 0x10b1a3746 ; symbol stub for: objc_autoreleasePoolPush
0x10a755633 <+104>: movq %rax, %rbx
0x10a755636 <+107>: movl %r12d, %edi
0x10a755639 <+110>: movq %r15, %rsi
0x10a75563c <+113>: movq %r14, %rdx
0x10a75563f <+116>: movq %r13, %rcx
0x10a755642 <+119>: callq 0x10a755698 ; _UIApplicationMainPreparations
0x10a755647 <+124>: movq %rbx, %rdi
0x10a75564a <+127>: callq 0x10b1a3740 ; symbol stub for: objc_autoreleasePoolPop
0x10a75564f <+132>: jmp 0x10a755662 ; <+151>
0x10a755651 <+134>: movl %r12d, %edi
0x10a755654 <+137>: movq %r15, %rsi
0x10a755657 <+140>: movq %r14, %rdx
0x10a75565a <+143>: movq %r13, %rcx
0x10a75565d <+146>: callq 0x10a755698 ; _UIApplicationMainPreparations
0x10a755662 <+151>: movq 0xcc59df(%rip), %rdi ; UIApp
0x10a755669 <+158>: movq 0xc4a3c8(%rip), %rsi ; "_run"
0x10a755670 <+165>: callq *0xcc7b0a(%rip) ; (void *)0x000000010be1e800: objc_msgSend
0x10a755676 <+171>: movq 0xcc7b0b(%rip), %rbx ; (void *)0x000000010be1bd70: objc_release <--- DEAD
0x10a7555cb:pushq%rbp
0x10a7555cc:movq%rsp,%rbp
0x10a7555cf:pushq%r15
0x10a7555d1:pushq%r14
0x10a7555d3:pushq%r13
0x10a7555d5:pushq%r12
0x10a7555d7:pushq%rbx
0x10a7555d8:pushq%rax
0x10a7555d9:movq%rcx,%rbx
0x10a7555dc:movq%rsi,%r15
0x10a7555df:移动%edi,%r12d
0x10a7555e2:movq 0xcc7ba7(%rip),%r13;(无效*)0x000000010be1bd00:objc_retain
0x10a7555e9:movq%rdx,%rdi
0x10a7555ec:callq*%r13
0x10a7555ef:movq%rax,%r14
0x10a7555f2:movq%rbx,%rdi
0x10a7555f5:callq*%r13
0x10a7555f8:movq%rax,%r13
0x10a7555fb:leaq 0xcc5aea(%rip),%rbx_UIApplicationLink转换
0x10a755602:movl(%rbx),%eax
0x10a755604:testl%eax,%eax
0x10a755606:jne 0x10a755627;
0x10a755608:cmpq$-0x1,0xcc18a0(%rip);WebKitSetIsClassic+7
0x10a755610:je 0x10a755651;
0x10a755612:leaq 0xcc1897(%rip),%rdi_UIApplicationLink转换
0x10a755619:leaq 0xccaeb0(%rip),%rsi__块\文字\全局1457
0x10a755620:callq 0x10b1a3f5c;符号存根:发送一次
0x10a755625:movl(%rbx),%eax
0x10a755627:cmpl$0x20100,%eax
0x10a75562c:jb 0x10a755651;
0x10a75562e:callq 0x10b1a3746;用于:objc_autoreleasePoolPush的符号存根
0x10a755633:movq%rax,%rbx
0x10a755636:移动%r12d,%edi
0x10a755639:movq%r15,%rsi
0x10a75563c:movq%r14,%rdx
0x10a75563f:movq%r13,%rcx
0x10a755642:callq 0x10a755698_UIA应用主要制剂
0x10a755647:movq%rbx,%rdi
0x10a75564a:callq 0x10b1a3740;用于:objc_autoreleasePoolPop的符号存根
0x10a75564f:jmp 0x10a755662;
0x10a755651:移动%r12d,%edi
0x10a755654:movq%r15,%rsi
0x10a755657:movq%r14,%rdx
0x10a75565a:movq%r13,%rcx
0x10a75565d:callq 0x10a755698_UIA应用主要制剂
0x10a755662:movq 0xcc59df(%rip),%rdi;UIApp
0x10a755669:movq 0xc4a3c8(%rip),%rsi;“_run”
0x10a755670:callq*0xcc7b0a(%rip);(无效*)0x000000010be1e800:objc_msgSend
0x10a755676:movq 0xcc7b0b(%rip),%rbx;(void*)0x000000010be1bd70:objc_release如果UIViewController上有一个名为window的属性的类别,这就是结果。这只发生在iOS 9发布后。随着iOS 9的发布,苹果在UIViewController上引入了一个名为window的属性——检查变量名的使用情况
0x10a7555cb <+0>: pushq %rbp
0x10a7555cc <+1>: movq %rsp, %rbp
0x10a7555cf <+4>: pushq %r15
0x10a7555d1 <+6>: pushq %r14
0x10a7555d3 <+8>: pushq %r13
0x10a7555d5 <+10>: pushq %r12
0x10a7555d7 <+12>: pushq %rbx
0x10a7555d8 <+13>: pushq %rax
0x10a7555d9 <+14>: movq %rcx, %rbx
0x10a7555dc <+17>: movq %rsi, %r15
0x10a7555df <+20>: movl %edi, %r12d
0x10a7555e2 <+23>: movq 0xcc7ba7(%rip), %r13 ; (void *)0x000000010be1bd00: objc_retain
0x10a7555e9 <+30>: movq %rdx, %rdi
0x10a7555ec <+33>: callq *%r13
0x10a7555ef <+36>: movq %rax, %r14
0x10a7555f2 <+39>: movq %rbx, %rdi
0x10a7555f5 <+42>: callq *%r13
0x10a7555f8 <+45>: movq %rax, %r13
0x10a7555fb <+48>: leaq 0xcc5aea(%rip), %rbx ; _UIApplicationLinkedOnVersion
0x10a755602 <+55>: movl (%rbx), %eax
0x10a755604 <+57>: testl %eax, %eax
0x10a755606 <+59>: jne 0x10a755627 ; <+92>
0x10a755608 <+61>: cmpq $-0x1, 0xcc18a0(%rip) ; WebKitSetIsClassic + 7
0x10a755610 <+69>: je 0x10a755651 ; <+134>
0x10a755612 <+71>: leaq 0xcc1897(%rip), %rdi ; _UIApplicationLinkedOnVersionOnce
0x10a755619 <+78>: leaq 0xccaeb0(%rip), %rsi ; __block_literal_global1457
0x10a755620 <+85>: callq 0x10b1a3f5c ; symbol stub for: dispatch_once
0x10a755625 <+90>: movl (%rbx), %eax
0x10a755627 <+92>: cmpl $0x20100, %eax
0x10a75562c <+97>: jb 0x10a755651 ; <+134>
0x10a75562e <+99>: callq 0x10b1a3746 ; symbol stub for: objc_autoreleasePoolPush
0x10a755633 <+104>: movq %rax, %rbx
0x10a755636 <+107>: movl %r12d, %edi
0x10a755639 <+110>: movq %r15, %rsi
0x10a75563c <+113>: movq %r14, %rdx
0x10a75563f <+116>: movq %r13, %rcx
0x10a755642 <+119>: callq 0x10a755698 ; _UIApplicationMainPreparations
0x10a755647 <+124>: movq %rbx, %rdi
0x10a75564a <+127>: callq 0x10b1a3740 ; symbol stub for: objc_autoreleasePoolPop
0x10a75564f <+132>: jmp 0x10a755662 ; <+151>
0x10a755651 <+134>: movl %r12d, %edi
0x10a755654 <+137>: movq %r15, %rsi
0x10a755657 <+140>: movq %r14, %rdx
0x10a75565a <+143>: movq %r13, %rcx
0x10a75565d <+146>: callq 0x10a755698 ; _UIApplicationMainPreparations
0x10a755662 <+151>: movq 0xcc59df(%rip), %rdi ; UIApp
0x10a755669 <+158>: movq 0xc4a3c8(%rip), %rsi ; "_run"
0x10a755670 <+165>: callq *0xcc7b0a(%rip) ; (void *)0x000000010be1e800: objc_msgSend
0x10a755676 <+171>: movq 0xcc7b0b(%rip), %rbx ; (void *)0x000000010be1bd70: objc_release <--- DEAD