当我通过xcode安装时它工作正常,但是当我导出.ipa(Ad hoc)并通过iTunes安装在我的iphone上时它会崩溃。以下是日志文件。如果有人遇到类似的问题,请帮助。
Last Exception Backtrace:
0 CoreFoundation 0x1828f82d8 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x19411c0e4 objc_exception_throw + 60
2 CoreFoundation 0x1828ff290 +[NSObject(NSObject) doesNotRecognizeSelector:] + 220
3 CoreFoundation 0x1828fc154 ___forwarding___ + 928
4 CoreFoundation 0x1827feccc _CF_forwarding_prep_0 + 92
5 ctapp 0x1001bd84c function signature specialization <Arg[0] = Owned To Guaranteed> of ctapp.ClassListVC.viewDidLoad (ctapp.ClassListVC)() -> () (ClassListVC.swift:49)
6 ctapp 0x1001b9f28 @objc ctapp.ClassListVC.viewDidLoad (ctapp.ClassListVC)() -> () (ClassListVC.swift:0)
7 UIKit 0x187338c84 -[UIViewController loadViewIfRequired] + 692
8 UIKit 0x187338994 -[UIViewController view] + 32
9 UIKit 0x18746ee68 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 452
10 UIKit 0x18746eb58 -[UITabBarController _setSelectedViewController:] + 360
11 UIKit 0x187346b6c +[UIView(Animation) performWithoutAnimation:] + 88
12 UIKit 0x187472d90 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 236
13 UIKit 0x187471c98 -[UITabBarController viewWillAppear:] + 160
14 UIKit 0x18734ff74 -[UIViewController _setViewAppearState:isAnimating:] + 516
15 UIKit 0x1874db328 -[UINavigationController _startCustomTransition:] + 916
16 UIKit 0x1873edef0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 468
17 UIKit 0x1873edcbc -[UINavigationController __viewWillLayoutSubviews] + 56
18 UIKit 0x1873edc3c -[UILayoutContainerView layoutSubviews] + 200
19 UIKit 0x187335760 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 580
20 QuartzCore 0x186c7de1c -[CALayer layoutSublayers] + 152
21 QuartzCore 0x186c78884 CA::Layer::layout_if_needed(CA::Transaction*) + 320
22 QuartzCore 0x186c78728 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
23 QuartzCore 0x186c77ebc CA::Context::commit_transaction(CA::Transaction*) + 276
24 QuartzCore 0x186c77c3c CA::Transaction::commit() + 528
25 QuartzCore 0x186c71364 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
26 CoreFoundation 0x1828b02a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
27 CoreFoundation 0x1828ad230 __CFRunLoopDoObservers + 360
28 CoreFoundation 0x1828ad610 __CFRunLoopRun + 836
29 CoreFoundation 0x1827d92d4 CFRunLoopRunSpecific + 396
30 GraphicsServices 0x18bfef6fc GSEventRunModal + 168
31 UIKit 0x18739efac UIApplicationMain + 1488
32 ctapp 0x100232c28 main (AppDelegate.swift:25)
33 libdyld.dylib 0x19479aa08 start + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001948b3270 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000019495116c pthread_kill + 108
2 libsystem_c.dylib 0x000000019482ab14 abort + 108
3 libc++abi.dylib 0x00000001938e9414 abort_message + 112
4 libc++abi.dylib 0x0000000193908b88 default_terminate_handler() + 300
5 libobjc.A.dylib 0x000000019411c3bc _objc_terminate() + 124
6 libc++abi.dylib 0x0000000193905bb0 std::__terminate(void (*)()) + 12
7 libc++abi.dylib 0x0000000193905474 __cxa_throw + 132
8 libobjc.A.dylib 0x000000019411c200 objc_exception_throw + 344
9 CoreFoundation 0x00000001828ff28c +[NSObject(NSObject) doesNotRecognizeSelector:] + 216
10 CoreFoundation 0x00000001828fc150 ___forwarding___ + 924
11 CoreFoundation 0x00000001827fecc8 _CF_forwarding_prep_0 + 88
12 ctapp 0x00000001001bd848 function signature specialization <Arg[0] = Owned To Guaranteed> of ctapp.ClassListVC.viewDidLoad (ctapp.ClassListVC)() -> () (ClassListVC.swift:49)
13 ctapp 0x00000001001b9f24 @objc ctapp.ClassListVC.viewDidLoad (ctapp.ClassListVC)() -> () (ClassListVC.swift:0)
14 UIKit 0x0000000187338c80 -[UIViewController loadViewIfRequired] + 688
15 UIKit 0x0000000187338990 -[UIViewController view] + 28
16 UIKit 0x000000018746ee64 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 448
17 UIKit 0x000000018746eb54 -[UITabBarController _setSelectedViewController:] + 356
18 UIKit 0x0000000187346b68 +[UIView(Animation) performWithoutAnimation:] + 84
19 UIKit 0x0000000187472d8c -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 232
20 UIKit 0x0000000187471c94 -[UITabBarController viewWillAppear:] + 156
21 UIKit 0x000000018734ff70 -[UIViewController _setViewAppearState:isAnimating:] + 512
22 UIKit 0x00000001874db324 -[UINavigationController _startCustomTransition:] + 912
23 UIKit 0x00000001873edeec -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
24 UIKit 0x00000001873edcb8 -[UINavigationController __viewWillLayoutSubviews] + 52
25 UIKit 0x00000001873edc38 -[UILayoutContainerView layoutSubviews] + 196
26 UIKit 0x000000018733575c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 576
27 QuartzCore 0x0000000186c7de18 -[CALayer layoutSublayers] + 148
28 QuartzCore 0x0000000186c78880 CA::Layer::layout_if_needed(CA::Transaction*) + 316
29 QuartzCore 0x0000000186c78724 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
30 QuartzCore 0x0000000186c77eb8 CA::Context::commit_transaction(CA::Transaction*) + 272
31 QuartzCore 0x0000000186c77c38 CA::Transaction::commit() + 524
32 QuartzCore 0x0000000186c71360 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76
33 CoreFoundation 0x00000001828b02a0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
34 CoreFoundation 0x00000001828ad22c __CFRunLoopDoObservers + 356
35 CoreFoundation 0x00000001828ad60c __CFRunLoopRun + 832
36 CoreFoundation 0x00000001827d92d0 CFRunLoopRunSpecific + 392
37 GraphicsServices 0x000000018bfef6f8 GSEventRunModal + 164
38 UIKit 0x000000018739efa8 UIApplicationMain + 1484
39 ctapp 0x0000000100232c24 main (AppDelegate.swift:25)
40 libdyld.dylib 0x000000019479aa04 start + 0
答案 0 :(得分:0)
如果它可以帮助某人。我使用时应用崩溃了 swift中的UI_USER_INTERFACE_IDIOM()。
Haven你刚回答了自己的问题......?
其他人报告了同样的问题..
Detect current device with UI_USER_INTERFACE_IDIOM() in Swift
..并建议你可以使用它来解决它...
UIDevice.currentDevice().userInterfaceIdiom