質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Swift 2

Swift 2は、Apple社が独自に開発を行っている言語「Swift」のアップグレード版です。iOSやOS X、さらにLinuxにも対応可能です。また、throws-catchベースのエラーハンドリングが追加されています。

Q&A

解決済

1回答

2833閲覧

Build Succeededと表示されるが、アプリが起動されない

iwanharts

総合スコア32

iOS

iOSとは、Apple製のスマートフォンであるiPhoneやタブレット端末のiPadに搭載しているオペレーションシステム(OS)です。その他にもiPod touch・Apple TVにも搭載されています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Swift 2

Swift 2は、Apple社が独自に開発を行っている言語「Swift」のアップグレード版です。iOSやOS X、さらにLinuxにも対応可能です。また、throws-catchベースのエラーハンドリングが追加されています。

0グッド

0クリップ

投稿2016/08/28 07:25

編集2016/08/28 09:30

###前提・実現したいこと
個人的にiOSアプリの勉強をしていて、ドットインストールを参考にStopWatchを作成している。

###発生している問題・エラーメッセージ

Runさせると「Build Succeeded」と表示されるが、すぐに下のソースコードが表示され、「class AppDelegate: UIResponder, UIApplicationDelegate {」の部分(上から3行目)に、「Thread 1: signal SIGABRT」と表示される。

import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use ts his method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }

###試したこと
検索等をしてみたが、いまいちエラーの原因が分からない。

###補足情報(言語/FW/ツール等のバージョンなど)
今のところドットインストールをに従って作成しており、swiftのバージョンの関係上ソースコードを以下のように書き換えた。

import UIKit class ViewController: UIViewController { @IBOutlet weak var timerLabel: UILabel! @IBOutlet weak var startButton: UIButton! @IBOutlet weak var stopButton: UIButton! @IBOutlet weak var resetButton: UIButton! var starttime: NSTimeInterval? = nil var timer: NSTimer? 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. } func update() { if let t = self.starttime { let time: Double = NSDate.timeIntervalSinceReferenceDate() - t let sec: Int = Int(time) let msec: Int = Int((time - Double(sec)) * 100.0) self.timerLabel.text = NSString(format: "%02d:%02d:%02d", sec/60, sec%60, msec) as String } } @IBAction func startTimer(sender: AnyObject) { self.starttime = NSDate.timeIntervalSinceReferenceDate() self.timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: #selector(ViewController.update), userInfo: nil, repeats: true) } @IBAction func stopTimer(sender: AnyObject) { } @IBAction func resetTimer(sender: AnyObject) { } }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

_Kentarou

2016/08/28 07:59

自身が記述しているコード(ViewController等)を載せてください、現在載せて頂いているエラーメッセージでは具体的なアドバイスができません。
guest

回答1

0

ベストアンサー

おそらく@IBOutletの接続がうまくいっていないと思います。

一旦StroyboardUILabelUIButtonの解除して再度結び直してみてください。

デバックエリアに
setValue:forUndefinedKey:]: this class is not key value coding-compliant for
のようなメッセージが表示されていませんか?

投稿2016/08/28 09:49

_Kentarou

総合スコア8490

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

iwanharts

2016/08/28 10:14 編集

それがデバッグエリアに何も表示されていないんです。。。 接続ももう一度やってみましたが、変わらずです>< 他に何か考えられる原因はあるでしょうか?
_Kentarou

2016/08/28 11:16 編集

この状況だとIBOutletが正常に結ばれていないと思います、自分の手元では上記のコードをコピペして起動はしました。 新規プロジェクトに上記のコードをViewControllerにそのまま貼り付けてRunしてみてください(IBOutletは結ばなくて良いです)、画面にはなにもでませんが起動したら接続がおかしいです。
iwanharts

2016/08/28 12:31

コピペで実行したら起動はしました! コードを自分で直したので自信がなかったのですが、良かったです! 新規プロジェクトからやってみます!!! ありがとうございました^^
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問