私は iOS 開発の初心者で、Swift で基本的なことを学び始めたばかりです。自動レイアウトで練習している基本的なコーディングを実行しようとすると、エラーが発生します。ボタンをクリックしてダイアログを開こうとすると、以下の例外が発生します。参考までに私のサンプルコードも掲載しています
私が得ている例外は次のとおりです。
<NSLayoutConstraint:0x79e84ca0 V:[UILabel:0x79e82b40'sadadsfsadfsd']-(90)-[_UILayoutGuide:0x79e84610]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-10-01 00:04:18.833 FirstDemo[6922:355986] -[FirstDemo.ViewController showSomething]: unrecognized selector sent to instance 0x79e80210
2015-10-01 00:04:18.836 FirstDemo[6922:355986] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstDemo.ViewController showSomething]: unrecognized selector sent to instance 0x79e80210'
*** First throw call stack:
(
0 CoreFoundation 0x0025aa94 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01e5ce02 objc_exception_throw + 50
2 CoreFoundation 0x00263de3 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x001a1e3d ___forwarding___ + 1037
4 CoreFoundation 0x001a1a0e _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x01e710b5 -[NSObject performSelector:withObject:withObject:] + 84
6 UIKit 0x00a3dc40 -[UIApplication sendAction:to:from:forEvent:] + 118
7 UIKit 0x00a3dbbf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
8 UIKit 0x00bd38fc -[UIControl sendAction:to:forEvent:] + 79
9 UIKit 0x00bd3c7c -[UIControl _sendActionsForEvents:withEvent:] + 408
10 UIKit 0x00bd2c87 -[UIControl touchesEnded:withEvent:] + 714
11 UIKit 0x00ab4eb8 -[UIWindow _sendTouchesForEvent:] + 1095
12 UIKit 0x00ab5da4 -[UIWindow sendEvent:] + 1118
13 UIKit 0x00a5e9b3 -[UIApplication sendEvent:] + 266
14 UIKit 0x00a35903 _UIApplicationHandleEventQueue + 7327
15 CoreFoundation 0x00174e7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x0016ab0b __CFRunLoopDoSources0 + 523
17 CoreFoundation 0x00169f28 __CFRunLoopRun + 1032
18 CoreFoundation 0x00169866 CFRunLoopRunSpecific + 470
19 CoreFoundation 0x0016967b CFRunLoopRunInMode + 123
20 GraphicsServices 0x045fa664 GSEventRunModal + 192
21 GraphicsServices 0x045fa4a1 GSEventRun + 104
22 UIKit 0x00a3bcc1 UIApplicationMain + 160
23 FirstDemo 0x000784fc main + 140
24 libdyld.dylib 0x028cda21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
ViewController.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func showMessage(){
let alertController = UIAlertController(title:"Success",message:"Awesome done",preferredStyle:UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
}
私を助けてください。私の質問が明確でない場合は、親切に私にテキストを送ってください。前もって感謝します