移动Swift iOS应用程序支持苹果电视成为新目标

移动Swift iOS应用程序支持苹果电视成为新目标,ios,swift,tvos,apple-tv,Ios,Swift,Tvos,Apple Tv,也许有人能帮上忙,我正在尝试移动我的应用程序,以促进苹果电视的新目标。 我创建了新的故事板,并以与iOS应用程序相同的方式链接所有内容。当我试图启动应用程序时,在执行AppDelegate之后(在它进入初始控制器的viewDidLoad之前),我得到以下异常 有什么想法吗 2015-09-19 12:24:44.629 App TV[46733:3797033] *** Terminating app due to uncaught exception 'CALayerInvalid', re

也许有人能帮上忙,我正在尝试移动我的应用程序,以促进苹果电视的新目标。 我创建了新的故事板,并以与iOS应用程序相同的方式链接所有内容。当我试图启动应用程序时,在执行
AppDelegate
之后(在它进入初始控制器的
viewDidLoad
之前),我得到以下异常

有什么想法吗

 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
2015-09-19 12:24:44.629应用程序电视[46733:3797033]***由于未捕获的异常“CALayerInvalid”而终止应用程序,原因是:“层是其层树中循环的一部分”
***第一次抛出调用堆栈:
(
0 CoreFoundation 0x000000010e850105例外预处理+165
1 libobjc.A.dylib 0x000000010f271deb objc_异常_抛出+48
2 CoreFoundation 0x000000010e85003d+[N异常提升:格式:][205
3个QuartzCore 0x0000000111d2f74a _ZN2CA5层30确保事务的循环重复执行事务+102
4个QuartzCore 0x0000000111d2f795\u ZN2CA5层30确保事务重复执行\u 11事务+177
5个QuartzCore 0x0000000111d2f795\u ZN2CA5层30确保事务重复执行\u 11事务+177
6个QuartzCore 0x0000000111d2f795\u ZN2CA5层30确保事务重复执行\u 11事务+177
7夸脱核心0x0000000111d37439_Zn2Ca5层插入子层交易7 Calayerm+389
8夸脱矿0x0000000111d3782a-[CALayer addSublayer:+193
9 UIKit 0x000000010d2ce424-[UIView(内部)\u addSubview:定位:相对位置:][1512
10 UIKit 0x000000010d5b1b56-[UIButton initWithCoder:+1424
11 UIKit 0x000000010d79dd62 UINIBDecderCodeObjectForValue+705
12 UIKit 0x000000010d79da98-[UINibDecoder decodeObjectForKey:+278
13 UIKit 0x000000010d5d1315-[UIRuntimeConnection initWithCoder:][134
14 UIKit 0x000000010d5d1a77-[UIRuntimeEventConnection initWithCoder:][60
15 UIKit 0x000000010d79dd62 UINIBDecordeCodeObjectForValue+705
16 UIKit 0x000000010d79df23 UINIBDecordeCodeObjectForValue+1154
17 UIKit 0x000000010d79da98-[UINibDecoder decodeObjectForKey:+278
18 UIKit 0x000000010d5d0555-[UINib实例化所有者:选项:][1255
19 UIKit 0x000000010d3ad7f2-[UIViewController\u loadViewFromNibNamed:bundle:][381
20 UIKit 0x000000010d3ae11e-[UIViewController loadView]+178
21 UIKit 0x000000010d3ae47d-[UIViewController loadViewIfRequired]+139
22 UIKit 0x000000010d3aec7e-[UIViewController视图]+27
23 UIKit 0x000000010d289484-[UIWindow AddRootViewControllerServiceWifPossible]+61
24 UIKit 0x000000010d289b81-[UIWindow\u setHidden:强制:][302
25 UIKit 0x000000010d29b558-[UIWindow makeKeyAndVisible]+43
26 UIKit 0x000000010d216063-[UIApplication\u callInitializationDelegatesForMainScene:transitionContext:+4131
27 UIKit 0x000000010d21c5a8-[UIApplication\u在主场景中运行:transitionContext:completion:+1755
28 UIKit 0x000000010d219783-[UIApplication WorkspaceDiEndTransaction:][188
29 FrontBoardServices 0x000000011097b7ac-[FBSSerialQueue\u performNext]+192
30 FrontBoardServices 0x000000011097bb1a-[FBSSerialQueue _performNextFromRunLoopSource]+45
31 CoreFoundation 0x000000010e77c1b1 \uuuuu CFRUNLOOP\u正在调用\uu OUT\u以执行\uu函数\uuuu+17
32 CoreFoundation 0x000000010e7720dc\uuu CFRunLoopDoSources0+556
33 CoreFoundation 0x000000010e771593\uuu CFRunLoopRun+867
34 CoreFoundation 0x000000010e770fa8 CFRunLoopRunSpecific+488
35 UIKit 0x000000010d2190d5-[UIU应用程序运行]+402
36 UIKit 0x000000010d21de09 UIApplicationMain+171
37 App TV 0x000000010d0b8fdd干管+109
38 libdyld.dylib 0x00000001149699e9开始+1
)
libc++abi.dylib:以NSException类型的未捕获异常终止

您可以通过激活异常断点来通知异常发生的位置,然后您将能够看到发生了什么


您可以通过在Xcode上打开断点导航器,然后点击左下角的加号按钮来实现这一点。

有趣的事情发生了,显然是新的Apple TV(第四代/tvOS v9.0)无法处理按钮上的“换行”,在将其设置为“截断中间”后,它会正常启动。可能是测试版中的问题。

在Xcode 7.2上,将按钮上的换行符设置为“字符换行”会导致相同的错误。更改为“截断中间”会停止崩溃。

谢谢!我刚刚花了一天时间试图解决这个问题。这s仍然存在问题,GM的9.0“Truncate Tail”也导致了错误,解决方案是切换到“Truncate Middle”