Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 523
Stefan Avatar asked Dec 14 '22 11:12

Stefan


2 Answers

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.

like image 68
Stefan Avatar answered Dec 28 '22 05:12

Stefan


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.

like image 45
ihniwgo Avatar answered Dec 28 '22 06:12

ihniwgo