私はSwiftを使ってMacアプリケーションを開発しています。Xcode Macアプリケーション(Swift)の問題
そして、私はそれが私がこの長い記事については本当に申し訳ありません、私はiOSアプリケーションに
をやったのと同じだろうと思った原因私はそこに多くの問題を得た:(
最初の問題:
エラー: "メソッドがそのスーパークラスからの任意のメソッドをオーバーライドしない"
コード:
import Cocoa
クラスCreateAccountViewController:NSViewController {
@IBOutlet weak var emailTextField: NSTextField!
@IBOutlet weak var passwordTextField: NSSecureTextField!
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.
}
次のもの:
エラー:
self.dismissViewControllerAnimated(true, completion: nil)
:タイプ 'CreateAccountViewController' の値はメンバー 'dismissViewControllerAnimated'
コードを有していません最後のもの:
エラー:未解決の識別子の使用「UIAlertController」
コード:
let alert = UIAlertController(title: "Error", message: "Enter Email and Password", preferredStyle: .Alert)
私はとても申し訳ありませんが、これは、私は、Macのアプリケーションを書いた私の最初の時間です。
はい、代わりに角かっこで書く必要がありますか? –
これを次のように空に初期化することができます: 'let alert = NSAlert()' 初期化の後に必要なプロパティを追加します。 'alert.message ="メールとパスワードを入力してください " [NSAlertクラスのリファレンス](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAlert_Class/) – Maxador
しかし、今すぐ別のエラーが発生しました:タイプ 'NSAlert'の値にメンバ 'message'がありませんこのコードでは: 'let alert = NSAlert() alert.message ="メールとパスワードを入力してください " –