crash on Unwind Segue after orientation change - ios

I have an unwind segue which works fine in landscape or portrait on iOS 9.3, but throws the following exception if I rotate the device between presenting the target view controller (A) and the view controller performing the unwind (C).
Any ideas why this happens, and how to work around this problem?
A high level view of my storyboard:
The exception:
2016-03-28 16:58:14.194 ClarityLife[96444:11508887] *** Assertion failure in -[_UIStoryboardUnwindChain initFromSourceViewController:toDestinationViewController:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UIStoryboardUnwindSegueTemplate.m:119
2016-03-28 16:58:14.202 ClarityLife[96444:11508887] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not unwind from <ClarityLife.VideoCallDisconnectingViewController: 0x7fdaa07c2b50> to <ClarityLife.VideoCallIdleViewController: 0x7fdaa2c13ab0> because a common ancestor could not be found. (Note that it is not supported to unwind from a view controller to one of its descendants.)'
*** First throw call stack:
(
0 CoreFoundation 0x000000011128bd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000113f92deb objc_exception_throw + 48
2 CoreFoundation 0x000000011128bbea +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000111e93d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x0000000113384c97 -[_UIStoryboardUnwindChain initFromSourceViewController:toDestinationViewController:] + 908
5 UIKit 0x0000000113385e49 -[UIStoryboardUnwindSegueTemplate newDefaultPerformHandlerForSegue:] + 125
6 UIKit 0x000000011315e395 -[UIStoryboardSegueTemplate segueWithDestinationViewController:] + 431
7 UIKit 0x00000001133865b7 -[UIStoryboardUnwindSegueTemplate segueWithDestinationViewController:] + 631
8 UIKit 0x00000001133868ae -[UIStoryboardUnwindSegueTemplate _performWithDestinationViewController:sender:] + 120
9 UIKit 0x0000000113386808 -[UIStoryboardUnwindSegueTemplate _perform:] + 86
10 UIKit 0x0000000112bb45f8 -[UIViewController performSegueWithIdentifier:sender:] + 99
11 ClarityLife 0x000000010fa6f9c5 _TFC11ClarityLife36VideoCallDisconnectingViewController13viewDidAppearfSbT_ + 261
12 ClarityLife 0x000000010fa6fa21 _TToFC11ClarityLife36VideoCallDisconnectingViewController13viewDidAppearfSbT_ + 49
13 UIKit 0x0000000112bb7335 -[UIViewController _setViewAppearState:isAnimating:] + 830
14 UIKit 0x0000000112bb7cb8 -[UIViewController _endAppearanceTransition:] + 262
15 UIKit 0x0000000112b8208a -[UIPresentationController transitionDidFinish:] + 827
16 UIKit 0x0000000112d5f38f -[_UICurrentContextPresentationController transitionDidFinish:] + 42
17 UIKit 0x0000000112b857c1 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183
18 UIKit 0x00000001134444c8 -[_UIViewControllerTransitionContext completeTransition:] + 101
19 UIKit 0x0000000112b7ef77 -[UITransitionView notifyDidCompleteTransition:] + 252
20 UIKit 0x0000000112b7ec88 -[UITransitionView _didCompleteTransition:] + 1344
21 UIKit 0x0000000112b813f4 -[UITransitionView _transitionDidStop:finished:] + 104
22 UIKit 0x0000000112aa47ff -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241
23 UIKit 0x0000000112aa4bae -[UIViewAnimationState animationDidStop:finished:] + 80
24 QuartzCore 0x00000001128c93c8 _ZN2CA5Layer23run_animation_callbacksEPv + 308
25 libdispatch.dylib 0x00000001160393eb _dispatch_client_callout + 8
26 libdispatch.dylib 0x00000001160211ef _dispatch_main_queue_callback_4CF + 1738
27 CoreFoundation 0x00000001111e50f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
28 CoreFoundation 0x00000001111a6b99 __CFRunLoopRun + 2073
29 CoreFoundation 0x00000001111a60f8 CFRunLoopRunSpecific + 488
30 GraphicsServices 0x0000000115ad5ad2 GSEventRunModal + 161
31 UIKit 0x0000000112a16f09 UIApplicationMain + 171
32 ClarityLife 0x000000010fa11432 main + 114
33 libdyld.dylib 0x000000011606d92d start + 1
34 ??? 0x0000000000000001 0x0 + 1

Resolved. The problem is in the app delegate method:
func splitViewController(splitViewController: UISplitViewController,
collapseSecondaryViewController secondaryViewController: UIViewController,
ontoPrimaryViewController primaryViewController: UIViewController) -> Bool {
...
return true
}
This method fell through to return true, which caused splitViewController to collapse the target view controller (A), which is the secondaryViewController, prior to the unwind. The solution is to ensure the secondary is not collapsed by returning false, thereby ensuring that the target of the unwind is available.

Related

migrated project from xcode 8 to xcode 9 crash on launcher screen

Everything was working fine on xcode 7.3.1, Than I have to add braintree 3ds sdk which is supported on xcode 8. So, I migrated the code to xcode 8 and than xcode 9. Now, build working fine on below IOS 11 but on ios 11 and above app is crashing before opening new main screen. I am new to Ios please help.
it's crashing on this line :
let vc = storyboard?.instantiateViewController(withIdentifier: "KbNav") as! KabNavigationController
2018-08-30 12:25:52.730641+0500 Kab[2970:32711] *** Assertion failure in
-[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-
3698.33.6/_UINavigationBarVisualProviderModernIOS.m:569
2018-08-30 12:25:52.769549+0500 Kab[2970:32711] *** Terminating app due
to uncaught exception 'NSInternalInconsistencyException', reason: 'Sigh.
Contentview size is zero.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000115da712b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000114d50f41 objc_exception_throw + 48
2 CoreFoundation 0x0000000115dac2f2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00000001147f1d69 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x00000001131382f5 -[_UINavigationBarVisualProviderModernIOS _contentViewFittingHeight] + 265
5 UIKit 0x0000000112eb65e0 -[UINavigationItem _desiredHeightForBarMetrics:defaultHeightBlock:] + 90
6 UIKit 0x000000011313afa1 -[_UINavigationBarVisualProviderModernIOS heightRangeFittingWidth:] + 412
7 UIKit 0x000000011264a0ed -[UINavigationBar _heightRangeForNavigationItem:fittingWidth:] + 210
8 UIKit 0x0000000112726a98 -[UINavigationController _intrinsicNavigationBarHeightRangeForViewController:] + 187
9 UIKit 0x00000001127269b6 -[UINavigationController _preferredHeightForHidingNavigationBarForViewController:] + 628
10 UIKit 0x000000011271688f -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 356
11 UIKit 0x0000000112716cf8 -[UINavigationController _positionNavigationBarHidden:edge:] + 388
12 UIKit 0x000000011271e555 -[UINavigationController loadView] + 243
13 UIKit 0x00000001126e105c -[UIViewController loadViewIfRequired] + 195
14 UIKit 0x00000001126e18b9 -[UIViewController view] + 27
15 Kab 0x000000010f00faea -[SlideNavigationController setEnableShadow:] + 74
16 Kab 0x000000010f00d494 -[SlideNavigationController setup] + 244
17 Kab 0x000000010f00d1d1 -[SlideNavigationController initWithCoder:] + 145
18 Kab 0x000000010f20e1d6 _T08Kab0A20NavigationControllerCACSgSo7NSCoderC5coder_tcfc + 214
19 Kab 0x000000010f20e29f _T08Kab0A20NavigationControllerCACSgSo7NSCoderC5coder_tcfcTo + 47
20 UIKit 0x00000001129ca4c8 -[UIClassSwapper initWithCoder:] + 246
21 UIKit 0x0000000112c1f109 UINibDecoderDecodeObjectForValue + 704
22 UIKit 0x0000000112c1ee3e -[UINibDecoder decodeObjectForKey:] + 89
23 UIKit 0x000000011264675a -[UINavigationBar initWithCoder:] + 753
24 UIKit 0x0000000112c1f109 UINibDecoderDecodeObjectForValue + 704
25 UIKit 0x0000000112c1ee3e -[UINibDecoder decodeObjectForKey:] + 89
26 UIKit 0x0000000112eb15f2 -[UINavigationItem initWithCoder:] + 1018
27 UIKit 0x0000000112c1f109 UINibDecoderDecodeObjectForValue + 704
28 UIKit 0x0000000112c1ee3e -[UINibDecoder decodeObjectForKey:] + 89
29 UIKit 0x00000001126dc053 -[UIViewController initWithCoder:] + 432
30 Kab 0x000000010f29a6a8 _T08Kab18HomeViewControllerCACSgSo7NSCoderC5coder_tcfc + 7704
31 Kab 0x000000010f29a77f _T08Kab18HomeViewControllerCACSgSo7NSCoderC5coder_tcfcTo + 47
32 UIKit 0x00000001129ca4c8 -[UIClassSwapper initWithCoder:] + 246
33 UIKit 0x0000000112c1f109 UINibDecoderDecodeObjectForValue + 704
34 UIKit 0x0000000112c1ee3e -[UINibDecoder decodeObjectForKey:] + 89
35 UIKit 0x00000001129ca194 -[UIRuntimeConnection initWithCoder:] + 178
36 UIKit 0x00000001129ca8d0 -[UIRuntimeEventConnection initWithCoder:] + 59
37 UIKit 0x0000000112c1f109 UINibDecoderDecodeObjectForValue + 704
38 UIKit 0x0000000112c1f2a7 UINibDecoderDecodeObjectForValue + 1118
39 UIKit 0x0000000112c1ee3e -[UINibDecoder decodeObjectForKey:] + 89
40 UIKit 0x00000001129c9391 -[UINib instantiateWithOwner:options:] + 1262
41 UIKit 0x0000000112e59fc2 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
42 Kab 0x000000010f135a7b _T08Kabr24LaunchTourViewControllerC4skipyyXlF + 219
43 Kab 0x000000010f136118 _T08Kab24LaunchTourViewControllerC4skipyyXlFTo + 56
44 UIKit 0x000000011253a972 -[UIApplication sendAction:to:from:forEvent:] + 83
45 UIKit 0x00000001126b9c3c -[UIControl sendAction:to:forEvent:] + 67
46 UIKit 0x00000001126b9f59 -[UIControl _sendActionsForEvents:withEvent:] + 450
47 UIKit 0x00000001126b8e86 -[UIControl touchesEnded:withEvent:] + 618
48 UIKit 0x00000001125b0807 -[UIWindow _sendTouchesForEvent:] + 2807
49 UIKit 0x00000001125b1f2a -[UIWindow sendEvent:] + 4124
50 UIKit 0x0000000112555365 -[UIApplication sendEvent:] + 352
51 UIKit 0x0000000112ea1a1d __dispatchPreprocessedEventFromEventQueue + 2809
52 UIKit 0x0000000112ea4672 __handleEventQueueInternal + 5957
53 CoreFoundation 0x0000000115d4a101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
54 CoreFoundation 0x0000000115de9f71 __CFRunLoopDoSource0 + 81
55 CoreFoundation 0x0000000115d2ea19 __CFRunLoopDoSources0 + 185
56 CoreFoundation 0x0000000115d2dfff __CFRunLoopRun + 1279
57 CoreFoundation 0x0000000115d2d889 CFRunLoopRunSpecific + 409
58 GraphicsServices 0x0000000118d049c6 GSEventRunModal + 62
59 UIKit 0x00000001125395d6 UIApplicationMain + 159
60 Kab 0x000000010f191137 main + 55
61 libdyld.dylib 0x0000000117112d81 start + 1
62 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
KbNavigationController
class KabNavigationController: SlideNavigationController {
var menuItems: [(id: String, image: String, text: String)] = []
override func viewDidLoad() {
self.leftMenu = self.storyboard?.instantiateViewController(withIdentifier: "MenuViewController")
navigationBar.barTintColor = Theme.DarkGray
navigationBar.tintColor = Theme.White
navigationBar.barStyle = UIBarStyle.black
// Popup Navigation Bar
STPopupNavigationBar.appearance().isHidden = true
}
}
I have searched and debug my code alot keep in mind always enable exception break points to trigger exactly which line causing the crash. You can learn it from this Exception Breakpoint in Xcode . I found my solution here https://github.com/aryaxt/iOS-Slide-Menu/issues/250.
move these two lines from setup function to viewWillLayoutSubviews of Slide Menu.
//moved this from the `setup` function:
self.enableShadow = YES;
self.enableSwipeGesture = YES;

How to return the same viewController multiple times in swift(iOS) in a single run of the program?

I am writing a program using SpriteKit and UIKit.
I have two view controller in my program, first for main page and second for GameViewController (which includes GameScene). I have added a back button to the GameViewController which goes to main page (MainPageViewController). Everything works fine so far.
In my first page, when I wanted to go back again to GameViewController, program crashes and the following error is given:
GitarTelleri[959:47801] 15:21:39.405 ERROR:
AVAudioEngineGraph.mm:1743: _Connect: required condition is false:
!destNodeMixerConns.empty() && !isDestNodeConnectedToIONode 2016-09-19
15:21:39.413 GitarTelleri[959:47801] * Terminating app due to
uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required
condition is false: !destNodeMixerConns.empty() &&
!isDestNodeConnectedToIONode'
* First throw call stack: ( 0 CoreFoundation 0x0000000104250d85 exceptionPreprocess + 165 1 libobjc.A.dylib
0x00000001061d2deb objc_exception_throw + 48 2 CoreFoundation
0x0000000104250bea +[NSException raise:format:arguments:] + 106 3
libAVFAudio.dylib 0x000000010915eff3
_Z19AVAE_RaiseExceptionP8NSStringz + 176 4 libAVFAudio.dylib 0x0000000109171bc3
_ZN18AVAudioEngineGraph8_ConnectEP19AVAudioNodeImplBaseS1_jjP13AVAudioFormat
+ 1281 5 libAVFAudio.dylib 0x0000000109174df0 _ZN18AVAudioEngineGraph7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 322 6 libAVFAudio.dylib 0x00000001091a7a71
_ZN17AVAudioEngineImpl7ConnectEP11AVAudioNodeS1_mmP13AVAudioFormat + 301 7 libAVFAudio.dylib 0x00000001091a7ad8
-[AVAudioEngine connect:to:format:] + 83 8 AudioKit 0x00000001037a611b
_TTSf4n_d___TZFC8AudioKit8AudioKits6outputGSqCS_6AKNode_ + 267 9 GitarTelleri 0x000000010362c234
TFC12GitarTelleri18GameViewController13viewDidAppearfSbT + 196 10 GitarTelleri 0x000000010362c341
TToFC12GitarTelleri18GameViewController13viewDidAppearfSbT + 49 11 UIKit 0x0000000104df7335
-[UIViewController _setViewAppearState:isAnimating:] + 830 12 UIKit 0x0000000104e30589 -[UINavigationController viewDidAppear:] + 207 13
UIKit 0x0000000104df7335
-[UIViewController _setViewAppearState:isAnimating:] + 830 14 UIKit 0x0000000104df7cb8 -[UIViewController _endAppearanceTransition:] + 262
15 UIKit 0x0000000104dc208a
-[UIPresentationController transitionDidFinish:] + 827 16 UIKit 0x0000000104f9f38f -[_UICurrentContextPresentationController
transitionDidFinish:] + 42 17 UIKit
0x0000000104dc57c1 __56-[UIPresentationController
runTransitionForCurrentState]_block_invoke_2 + 183 18 UIKit
0x00000001056844c8 -[_UIViewControllerTransitionContext
completeTransition:] + 101 19 UIKit
0x0000000104dbef77 -[UITransitionView notifyDidCompleteTransition:] +
252 20 UIKit 0x0000000104dbec88
-[UITransitionView _didCompleteTransition:] + 1344 21 UIKit 0x0000000104dc13f4 -[UITransitionView _transitionDidStop:finished:] +
104 22 UIKit 0x0000000104ce47ff
-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241 23 UIKit 0x0000000104ce4bae
-[UIViewAnimationState animationDidStop:finished:] + 80 24 QuartzCore 0x0000000107d7d3c8
_ZN2CA5Layer23run_animation_callbacksEPv + 308 25 libdispatch.dylib 0x0000000108c773eb _dispatch_client_callout + 8 26 libdispatch.dylib
0x0000000108c5f1ef _dispatch_main_queue_callback_4CF + 1738 27
CoreFoundation 0x00000001041aa0f9
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 28 CoreFoundation 0x000000010416bb99 __CFRunLoopRun
+ 2073 29 CoreFoundation 0x000000010416b0f8 CFRunLoopRunSpecific + 488 30 GraphicsServices
0x000000010a189ad2 GSEventRunModal + 161 31 UIKit
0x0000000104c56f09 UIApplicationMain + 171 32 GitarTelleri
0x0000000103630372 main + 114 33 libdyld.dylib
0x0000000108cab92d start + 1 34 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with
uncaught exception of type NSException (lldb)
Should I change something in AppDelegate.swift or should I clean something when BackButton is clicked?
check your back button have AudioKit.stop()

Terminating app due to uncaught exception 'NSInternalInconsistencyException' with name 'OverlayView'

I intend to use a custom view Koloda in my newly-created swift xcode project via Podfile. After pod install, creating KolodaView in Main.storyboard and building successfully, it complains exception when running as follows:
2016-08-20 09:44:38.918 MsgNotFree[25760:2220650] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/jasonzhu/Library/Developer/CoreSimulator/Devices/DDE42B9D-6304-4552-AD30-A1BFA3A7B3E0/data/Containers/Bundle/Application/D1282CEB-9914-4C37-BCD2-DC05675C9FD1/MsgNotFree.app> (loaded)' with name 'OverlayView''
*** First throw call stack:
(
0 CoreFoundation 0x000000010a227d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c8d4deb objc_exception_throw + 48
2 CoreFoundation 0x000000010a227cbd +[NSException raise:format:] + 205
3 UIKit 0x000000010b720c89 -[UINib instantiateWithOwner:options:] + 499
4 UIKit 0x000000010b723415 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 223
5 MsgNotFree 0x0000000109eedd90 _TFC10MsgNotFree19FirstViewController6kolodafTCS_10KolodaView25viewForCardOverlayAtIndexSu_GSqCS_11OverlayView_ + 368
6 MsgNotFree 0x0000000109eedf92 _TToFC10MsgNotFree19FirstViewController6kolodafTCS_10KolodaView25viewForCardOverlayAtIndexSu_GSqCS_11OverlayView_ + 66
7 MsgNotFree 0x0000000109eee918 _TTDFC10MsgNotFree19FirstViewController6kolodafTCS_10KolodaView25viewForCardOverlayAtIndexSu_GSqCS_11OverlayView_ + 56
8 MsgNotFree 0x0000000109eee085 _TTWC10MsgNotFree19FirstViewControllerS_20KolodaViewDataSourceS_FS1_6kolodafTCS_10KolodaView25viewForCardOverlayAtIndexSu_GSqCS_11OverlayView_ + 53
9 Koloda 0x0000000109ff14f5 _TFC6Koloda10KolodaView13configureCardfTCS_17DraggableCardView7atIndexSu_T_ + 501
10 Koloda 0x0000000109ff15b2 _TToFC6Koloda10KolodaView13configureCardfTCS_17DraggableCardView7atIndexSu_T_ + 66
11 Koloda 0x0000000109ff1183 _TFC6Koloda10KolodaView17createCardAtIndexfTSu5frameGSqVSC6CGRect__CS_17DraggableCardView + 611
12 Koloda 0x0000000109ff292b _TFC6Koloda10KolodaViewP33_DFF55D12D516409CF60937DD60F8B8969setupDeckfT_T_ + 955
13 Koloda 0x0000000109ff1e60 _TFC6Koloda10KolodaViewW10dataSourceXwGSqPS_20KolodaViewDataSource__ + 32
14 Koloda 0x0000000109ff1f60 _TFC6Koloda10KolodaViews10dataSourceXwGSqPS_20KolodaViewDataSource__ + 160
15 MsgNotFree 0x0000000109eec73e _TFC10MsgNotFree19FirstViewController11viewDidLoadfT_T_ + 398
16 MsgNotFree 0x0000000109eec802 _TToFC10MsgNotFree19FirstViewController11viewDidLoadfT_T_ + 34
17 UIKit 0x000000010b4f3984 -[UIViewController loadViewIfRequired] + 1198
18 UIKit 0x000000010b4f3cd3 -[UIViewController view] + 27
19 UIKit 0x000000010b5571bc -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 502
20 UIKit 0x000000010b556130 -[UITabBarController transitionFromViewController:toViewController:] + 59
21 UIKit 0x000000010b551f41 -[UITabBarController _setSelectedViewController:] + 377
22 UIKit 0x000000010b551db7 -[UITabBarController setSelectedViewController:] + 234
23 UIKit 0x000000010b408680 +[UIView(Animation) performWithoutAnimation:] + 65
24 UIKit 0x000000010b54bddc -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 344
25 UIKit 0x000000010b54d5df -[UITabBarController viewWillAppear:] + 193
26 UIKit 0x000000010b4f92bd -[UIViewController _setViewAppearState:isAnimating:] + 710
27 UIKit 0x000000010b4f9958 -[UIViewController __viewWillAppear:] + 149
28 UIKit 0x000000010b401255 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 633
29 UIKit 0x000000010b40fc9e -[UIView(Internal) _addSubview:positioned:relativeTo:] + 481
30 UIKit 0x000000010b3ca29a -[UIWindow addRootViewControllerViewIfPossible] + 803
31 UIKit 0x000000010b3ca69d -[UIWindow _setHidden:forced:] + 282
32 UIKit 0x000000010b3dc180 -[UIWindow makeKeyAndVisible] + 42
33 UIKit 0x000000010b350ed9 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
34 UIKit 0x000000010b357568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
35 UIKit 0x000000010b354714 -[UIApplication workspaceDidEndTransaction:] + 188
36 FrontBoardServices 0x000000010d40f8c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
37 FrontBoardServices 0x000000010d40f741 -[FBSSerialQueue _performNext] + 178
38 FrontBoardServices 0x000000010d40faca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
39 CoreFoundation 0x000000010a14d301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
40 CoreFoundation 0x000000010a14322c __CFRunLoopDoSources0 + 556
41 CoreFoundation 0x000000010a1426e3 __CFRunLoopRun + 867
42 CoreFoundation 0x000000010a1420f8 CFRunLoopRunSpecific + 488
43 UIKit 0x000000010b353f21 -[UIApplication _run] + 402
44 UIKit 0x000000010b358f09 UIApplicationMain + 171
45 MsgNotFree 0x0000000109eec272 main + 114
46 libdyld.dylib 0x00000001112d892d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
In which, OverlayView class could be referenced to in ViewController, which means the third-party class is being referred to correctly in the project level.
The demonstrating project is here
Could anyone give me some hint where the problem could be? Great thanks!
this error is due to there is no overlayView named .xib file in your bundle,
create a new file -> UserInterface -> View -> (rename it OverlayView)
now got OverlayView and select view there change its class to OverlayView.

Moving Swift iOS app to support Apple TV as a new Target

Maybe somebody can help, I'm trying to move my app to facilitate a new target for the Apple TV.
I create the new Storyboard and linked everything the same way as it has been in the iOS application. When I'm trying to start the application I get the following exception, after the AppDelegate is executed (before it goes into the viewDidLoad of the initial controller.
Any ideas?
2015-09-19 12:24:44.629 App TV[46733:3797033] *** Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CATransformLayer: 0x7fc1e0d51fc0> is a part of cycle in its layer tree'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e850105 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f271deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e85003d +[NSException raise:format:] + 205
3 QuartzCore 0x0000000111d2f74a _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 102
4 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
5 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
6 QuartzCore 0x0000000111d2f795 _ZN2CA5Layer30ensure_transaction_recursivelyEPNS_11TransactionE + 177
7 QuartzCore 0x0000000111d37439 _ZN2CA5Layer15insert_sublayerEPNS_11TransactionEP7CALayerm + 389
8 QuartzCore 0x0000000111d3782a -[CALayer addSublayer:] + 193
9 UIKit 0x000000010d2ce424 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1512
10 UIKit 0x000000010d5b1b56 -[UIButton initWithCoder:] + 1424
11 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
12 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
13 UIKit 0x000000010d5d1315 -[UIRuntimeConnection initWithCoder:] + 134
14 UIKit 0x000000010d5d1a77 -[UIRuntimeEventConnection initWithCoder:] + 60
15 UIKit 0x000000010d79dd62 UINibDecoderDecodeObjectForValue + 705
16 UIKit 0x000000010d79df23 UINibDecoderDecodeObjectForValue + 1154
17 UIKit 0x000000010d79da98 -[UINibDecoder decodeObjectForKey:] + 278
18 UIKit 0x000000010d5d0555 -[UINib instantiateWithOwner:options:] + 1255
19 UIKit 0x000000010d3ad7f2 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
20 UIKit 0x000000010d3ae11e -[UIViewController loadView] + 178
21 UIKit 0x000000010d3ae47d -[UIViewController loadViewIfRequired] + 139
22 UIKit 0x000000010d3aec7e -[UIViewController view] + 27
23 UIKit 0x000000010d289484 -[UIWindow addRootViewControllerViewIfPossible] + 61
24 UIKit 0x000000010d289b81 -[UIWindow _setHidden:forced:] + 302
25 UIKit 0x000000010d29b558 -[UIWindow makeKeyAndVisible] + 43
26 UIKit 0x000000010d216063 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
27 UIKit 0x000000010d21c5a8 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
28 UIKit 0x000000010d219783 -[UIApplication workspaceDidEndTransaction:] + 188
29 FrontBoardServices 0x000000011097b7ac -[FBSSerialQueue _performNext] + 192
30 FrontBoardServices 0x000000011097bb1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
31 CoreFoundation 0x000000010e77c1b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x000000010e7720dc __CFRunLoopDoSources0 + 556
33 CoreFoundation 0x000000010e771593 __CFRunLoopRun + 867
34 CoreFoundation 0x000000010e770fa8 CFRunLoopRunSpecific + 488
35 UIKit 0x000000010d2190d5 -[UIApplication _run] + 402
36 UIKit 0x000000010d21de09 UIApplicationMain + 171
37 App TV 0x000000010d0b8fdd main + 109
38 libdyld.dylib 0x00000001149699e9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Funny thing happening, apparently the new Apple TV (4th Gen / tvOS v9.0) can't handle 'Word Wrap' on a button, after setting it to 'Truncate Middle' it starts up fine. Maybe an issue in the beta.
On Xcode 7.2 I had this same error caused by setting the Line Break on a button to 'Character Wrap'. Changing to 'Truncate Middle' stopped the crash.
You can be notified where the exception occurs by activating Exception Breakpoints, then you will be able to see what happens.
You can do so by going on the Breakpoint navigator on Xcode, then on the Plus button at the bottom left.

iOS7 Crash - PopViewController called on a Landscape ViewController

When I call PopViewController on a landscape ViewController a crash occurs. However when i call PopViewController on a Portrait ViewController a crash doesn't occur.
This only occurs on iOS7 - worked fine previously...
[self.navigationController popViewControllerAnimated:TRUE];
I'm super stuck on this so any help would be appreciated :)
Here is my Symbolocated Crash Log:
Exception Type: EXC_CRASH (SIGABRT) Exception Codes:
0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0
Last Exception Backtrace: 0 CoreFoundation
0x2d9b2f4e __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3801b6aa objc_exception_throw + 34
2 CoreFoundation 0x2d9b2e90 +[NSException
raise:format:] + 100
3 UIKit 0x3020ee70 -[UIViewController
_preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:]
+ 496
4 UIKit 0x3020d6ae -[UIWindowController
transition:fromViewController:toViewController:target:didEndSelector:animation:]
+ 2054
5 UIKit 0x3023ff86 -[UIViewController
_dismissViewControllerWithTransition:from:completion:] + 1390
6 UIKit 0x301ef1e0 -[UIViewController
dismissViewControllerWithTransition:completion:] + 1024
7 UIKit 0x303ecae2 -[UINavigationController
_popViewControllerAndUpdateInterfaceOrientationAnimated:] + 814 8 UIKit 0x301ef6de -[UINavigationController
_popViewControllerWithTransition:allowPoppingLast:] + 290
9 MyApp 0x00087e5a 0x55000 + 208474
10 MyApp 0x00088c56 0x55000 + 212054
11 MyApp 0x000889aa 0x55000 + 211370
12 MyApp 0x000a13f6 0x55000 + 312310
13 UIKit 0x3023b540 -[UIWindowController
transitionViewDidComplete:fromView:toView:removeFromView:] + 1908
14 UIKit 0x3023acf6 __101-[UIWindowController
transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke293
+ 166
15 UIKit 0x3023ac1e
-[_UIViewControllerTransitionContext completeTransition:] + 70
16 UIKit 0x3023ab08 -[UITransitionView
notifyDidCompleteTransition:] + 284 17 UIKit
0x3023a610 -[UITransitionView _didCompleteTransition:] + 940
18 UIKit 0x3015bc32 -[UIViewAnimationState
sendDelegateAnimationDidStop:finished:] + 174
19 UIKit 0x3015bb4a -[UIViewAnimationState
animationDidStop:finished:] + 66
20 QuartzCore 0x2fdb3d04
CA::Layer::run_animation_callbacks(void*) + 228
21 libdispatch.dylib 0x384fed62 _dispatch_client_callout
+ 18
22 libdispatch.dylib 0x385057bc
_dispatch_main_queue_callback_4CF$VARIANT$mp + 264
23 CoreFoundation 0x2d97d81c
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 4
24 CoreFoundation 0x2d97c0f0 __CFRunLoopRun + 1296
25 CoreFoundation 0x2d8e6ce2 CFRunLoopRunSpecific +
518
26 CoreFoundation 0x2d8e6ac6 CFRunLoopRunInMode + 102
27 GraphicsServices 0x325b427e GSEventRunModal + 134
28 UIKit 0x30188a3c UIApplicationMain + 1132
29 MyApp 0x0005ca84 0x55000 + 31364
30 MyApp 0x0005ca0c 0x55000 + 31244
Turns out that the reason it crashed on iOS7 was due to a missing piece of code on the previous view controller to tell it to show the next previous page as portrait!
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
maybe your view controller had killed when you rotate, so when you call popViewControllerAnimated it will make crash.

Resources