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

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

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

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

Q&A

解決済

2回答

1008閲覧

シュミレーターがちゃんと作動しない

medamaoyaji

総合スコア14

Swift

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

0グッド

0クリップ

投稿2018/11/13 20:49

ナビゲーションコントローラーとテーブルビュー、WebKitビューを使用し、テーブルビューのセルをタッチするとサイトの画面に移動するアプリを作ろうとしています。イメージ説明
テーブルビューのコードには

import

1//WebListTableViewControllerはUITableViewControllerを継承している。このUITableViewControllerはUIViewControllerを継承し、UITableViewDelegeteとUITableViewDataSourseをプロトコルとして追加しているクラスのため、必要なものは初めから実装されている。 2class WebLisTableViewController: UITableViewController { 3let WebList = [ 4 (name:"けっつん ",url:"https://www.youtube.com/user/ketsugeketsuge"), 5 (name:"水溜りボンド",url:"https://www.youtube.com/channel/UCpOjLndjOqMoffA-fr8cbKA"), 6 (name:"水溜りボンドの日常",url:"https://www.youtube.com/channel/UCaTFX7ckdowpnwHWcJGH2KQ"), 7 (name:"キヨ",url:"https://www.youtube.com/channel/UCMJiPpN_09F0aWpQrgbc_qg") 8 ] 9 override func viewDidLoad() { 10 super.viewDidLoad() 11 12 // Uncomment the following line to preserve selection between presentations 13 // self.clearsSelectionOnViewWillAppear = false 14 15 // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 16 // self.navigationItem.rightBarButtonItem = self.editButtonItem 17 } 18 19 // MARK: - Table view data source 20 21 override func numberOfSections(in tableView: UITableView) -> Int { 22 // #warning Incomplete implementation, return the number of sections 23 return 1 24 } 25 26 override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 27 // #warning Incomplete implementation, return the number of rows 28 return WebList.count 29 } 30 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 31 32 let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) 33 34 let webDate = WebList[(indexPath as NSIndexPath).row] 35 cell.textLabel?.text = webDate.name //サイト名の表示  タイトル 36 cell.detailTextLabel?.text = webDate.url //URLの表示    サブタイトル 37 38 return cell 39 } 40//セグエで移動する前にデータを受け渡す 41 override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 42 //セグエがshowWebPageの時の処理 43 if segue.identifier == "showWebPage"{ 44 if let indexPath = self.tableView.indexPathForSelectedRow{ 45 let webDate = WebList[(indexPath as NSIndexPath).row] 46 (segue.destination as! ViewController).data = webDate 47 } 48 } 49 50 51} 52}

ViewControllerのコードは

import UIKit import WebKit class ViewController: UIViewController { @IBOutlet weak var webView: WKWebView! //シーン移動の際の設定されるWebデータ var data:(name:String,url:String)? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. //dataが設定されていればWebDateに代入 guard let WebDate = data else{ return } //表示するWebページのURLRequestを作る let myURL = URL(string: WebDate.url) let myRequest = URLRequest(url: myURL!) //Webにを読み込む webView.load(myRequest) } }

となっており、エラーは出ていない状態です。
ここで、シュミレーターを起動すると、
イメージ説明
ちゃんと表示されていない状態になってしまいます。
デバックエリアには
イメージ説明
と表示されています。
ネットで調べたところ、
イメージ説明
赤丸で囲ったところを設定したら解決できると書いてあり、設定してみたのですが、シュミレーターは同じ状態でちゃんと作動しません。
解決方法、解決するために何を調べたら良いかなどわかれば教えてください。よろしくお願いします。

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

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

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

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

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

guest

回答2

0

ベストアンサー

プロジェクト名にUnicodeの結合文字(今回の場合、「ビ」「ゲ」「ブ」といった濁点付きカタカナ)を使用すると、Xcodeが誤動作してStoryboardの設定がおかしくなるようです。これを修正するにはプロジェクト名を変更するしかないと思います。

半角の英数字だけを使ったプロジェクト名で新しくプロジェクトを作り直すことをお勧めします。

投稿2018/11/14 01:28

TakeOne

総合スコア6299

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

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

medamaoyaji

2018/11/18 06:46

回答が遅れてしまってすみません。 プロジェクト名を変えて作り直してみたら作動しました! ありがとうございます。
guest

0

CustomClassのModuleを空にして、InheritModuleFromTargetをオンにしてください

投稿2018/11/14 00:58

kosanai

総合スコア471

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

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

medamaoyaji

2018/11/17 05:43

やってみたんですが、ダメでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問