2016-12-29 11:03:12.874 Albhabet City 1[9872:259138] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Albhabet_City_1.IntroViewController 0x7fcf8ec14d60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key play.'
*** First throw call stack:
(
\t 0 CoreFoundation 0x0000000103c69d4b __exceptionPreprocess + 171
\t 1 libobjc.A.dylib 0x000000010336221e objc_exception_throw + 48
\t 2 CoreFoundation 0x0000000103c69c99 -[NSException raise] + 9
\t 3 Foundation 0x0000000102e709df -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
\t 4 UIKit 0x0000000104228293 -[UIViewController setValue:forKey:] + 88
\t 5 UIKit 0x000000010449c79e -[UIRuntimeOutletConnection connect] + 109
\t 6 CoreFoundation 0x0000000103c0e9e0 -[NSArray makeObjectsPerformSelector:] + 256
\t 7 UIKit 0x000000010449b122 -[UINib instantiateWithOwner:options:] + 1867
\t 8 UIKit 0x000000010422e9c5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
\t 9 UIKit 0x000000010422f2e7 -[UIViewController loadView] + 177
\t 10 UIKit 0x000000010422f61c -[UIViewController loadViewIfRequired] + 201
\t 11 UIKit 0x000000010422fe70 -[UIViewController view] + 27
\t 12 UIKit 0x0000000104af06a4 -[_UIFullscreenPresentationController _setPresentedViewController:] + 87
\t 13 UIKit 0x000000010420a702 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 141
\t 14 UIKit 0x0000000104242e97 -[UIViewController _presentViewController:withAnimationController:completion:] + 3956
\t 15 UIKit 0x000000010424626b -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 530
\t 16 UIKit 0x0000000104245d51 -[UIViewController presentViewController:animated:completion:] + 179
\t 17 UIKit 0x000000010424b41e -[UIViewController _showViewController:withAction:sender:] + 274
\t 18 UIKit 0x0000000104708fcc __66-[UIStoryboardShowSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 134
\t 19 UIKit 0x00000001048631dd -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 447
\t 20 UIKit 0x0000000104862fed -[UIStoryboardSegueTemplate _perform:] + 82
\t 21 UIKit 0x00000001048632af -[UIStoryboardSegueTemplate perform:] + 156
\t 22 UIKit 0x000000010408f8bc -[UIApplication sendAction:to:from:forEvent:] + 83
\t 23 UIKit 0x0000000104215c38 -[UIControl sendAction:to:forEvent:] + 67
\t 24 UIKit 0x0000000104215f51 -[UIControl _sendActionsForEvents:withEvent:] + 444
\t 25 UIKit 0x0000000104214e4d -[UIControl touchesEnded:withEvent:] + 668
\t 26 UIKit 0x00000001040fd545 -[UIWindow _sendTouchesForEvent:] + 2747
\t 27 UIKit 0x00000001040fec33 -[UIWindow sendEvent:] + 4011
\t 28 UIKit 0x00000001040ab9ab -[UIApplication sendEvent:] + 371
\t 29 UIKit 0x000000010489872d __dispatchPreprocessedEventFromEventQueue + 3248
\t 30 UIKit 0x0000000104891463 __handleEventQueue + 4879
\t 31 CoreFoundation 0x0000000103c0e761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
\t 32 CoreFoundation 0x0000000103bf398c __CFRunLoopDoSources0 + 556
\t 33 CoreFoundation 0x0000000103bf2e76 __CFRunLoopRun + 918
\t 34 CoreFoundation 0x0000000103bf2884 CFRunLoopRunSpecific + 420
\t 35 GraphicsServices 0x0000000109cc2a6f GSEventRunModal + 161
\t 36 UIKit 0x000000010408dc68 UIApplicationMain + 159
\t 37 Albhabet City 1 0x0000000102d7adbf main + 111
\t 38 libdyld.dylib 0x000000010734868d start + 1
\t 39 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
import UIKit
import AVFoundation
class IntroViewController: UIViewController {
var player:AVAudioPlayer = AVAudioPlayer()
@IBAction func play(_ sender: Any)
{
player.play()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
do
{
let audioPath = Bundle.main.path(forResource: "song", ofType: "mp3")
try player = AVAudioPlayer(contentsOf: NSURL(fileURLWithPath: audioPath!) as URL)
}
catch
{
//error
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
받은 오류라고 전화 시뮬레이터에서 버튼을 누릅니다.
여러 장면이있는 앱을 만들고 있습니다. 시뮬레이터에서 다른 슬라이드로 첫 단추를 클릭 할 때마다 "AppDelegate.swift"와 "클래스 응용 프로그램 대리인"으로 전환됩니다. "스레드 1 : 신호 SIGBART. The error, the failed simulator,
코드를 보여주세요! – phil652
그리고 stacktrace를보고/게시하십시오. – luk2302
또 다른 흥미로운 부분은 오류의 실제 원인과 스택 추적을 인쇄 한 오른쪽 하단의보기 내용입니다. 복사하여 질문에 붙여 넣으십시오. –