ios - XPC connection interrupted for Xcode 9 -
i newcomer xcode , swift. trying build tic-tac-toe app, when run it, nothing happens. screen black. in debugging area says: "xpc connection interrupted." tried restarting simulator , computer. same thing still happened. in case need it, here code:
// // viewcontroller.swift // tictactoe // // created kaminski on 7/17/17. // copyright © 2017 kaminski. rights reserved. // import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var webview: uiwebview! @iboutlet weak var winner: uilabel! //buttons @ibaction func buttonbr(_ sender: any) { } @iboutlet weak var buttonbr1: uibutton! @ibaction func buttonbm(_ sender: any) { } @iboutlet weak var buttonbm1: uibutton! @ibaction func buttonbl(_ sender: any) { } @iboutlet weak var buttonbl1: uibutton! @ibaction func buttonmr(_ sender: any) { } @iboutlet weak var buttonmr1: uibutton! @ibaction func buttonm(_ sender: any) { } @iboutlet weak var buttonm1: uibutton! @ibaction func buttonml(_ sender: any) { } @iboutlet weak var buttonml1: uibutton! @ibaction func buttontr(_ sender: any) { } @iboutlet weak var buttontr1: uibutton! @ibaction func buttontm(_ sender: any) { } @iboutlet weak var buttontm1: uibutton! @ibaction func buttontl(_ sender: any) { } @iboutlet weak var buttontl1: uibutton! //buttons let x = "x" let o = "o" var gameover = false //x , o buttons @ibaction func obutton(_ sender: any) { while gameover == false { if (sender anyobject).tag == 1 { buttontl1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 2 { buttontm1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 3 { buttontr1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 4 { buttonml1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 5 { buttonm1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 6 { buttonmr1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 7 { buttonbl1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 8 { buttonbm1.settitle("/(o)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 9 { buttonbr1.settitle("/(o)", for: uicontrolstate.normal) } } } @ibaction func xbutton(_ sender: any) { while gameover == false { if (sender anyobject).tag == 1 { buttontl1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 2 { buttontm1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 3 { buttontr1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 4 { buttonml1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 5 { buttonm1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 6 { buttonmr1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 7 { buttonbl1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 8 { buttonbm1.settitle("/(x)", for: uicontrolstate.normal) } else if (sender anyobject).tag == 9 { buttonbr1.settitle("/(x)", for: uicontrolstate.normal) } } } //x , o buttons @ibaction func reset(_ sender: any) { buttontl1.settitle(" ", for: uicontrolstate.normal) buttontm1.settitle(" ", for: uicontrolstate.normal) buttontr1.settitle(" ", for: uicontrolstate.normal) buttonml1.settitle(" ", for: uicontrolstate.normal) buttonm1.settitle(" ", for: uicontrolstate.normal) buttonmr1.settitle(" ", for: uicontrolstate.normal) buttonbl1.settitle(" ", for: uicontrolstate.normal) buttonbm1.settitle(" ", for: uicontrolstate.normal) buttonbr1.settitle(" ", for: uicontrolstate.normal) winner.text = (" ") } override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. while gameover == false { //winner x if buttontl1.currenttitle == "x" && buttontm1.currenttitle == "x" && buttontr1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttonml1.currenttitle == "x" && buttonm1.currenttitle == "x" && buttonmr1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttonbl1.currenttitle == "x" && buttonbm1.currenttitle == "x" && buttonbr1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttontl1.currenttitle == "x" && buttonml1.currenttitle == "x" && buttonbl1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttontm1.currenttitle == "x" && buttonm1.currenttitle == "x" && buttonbm1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttontr1.currenttitle == "x" && buttonmr1.currenttitle == "x" && buttonbr1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttontl1.currenttitle == "x" && buttonm1.currenttitle == "x" && buttonbr1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } else if buttontr1.currenttitle == "x" && buttonm1.currenttitle == "x" && buttonbl1.currenttitle == "x" { winner.text = "player x wins!" gameover = true } // winner x // winner o if buttontl1.currenttitle == "o" && buttontm1.currenttitle == "o" && buttontr1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttonml1.currenttitle == "o" && buttonm1.currenttitle == "o" && buttonmr1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttonbl1.currenttitle == "o" && buttonbm1.currenttitle == "o" && buttonbr1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttontl1.currenttitle == "o" && buttonml1.currenttitle == "o" && buttonbl1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttontm1.currenttitle == "o" && buttonm1.currenttitle == "o" && buttonbm1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttontr1.currenttitle == "o" && buttonmr1.currenttitle == "o" && buttonbr1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttontl1.currenttitle == "o" && buttonm1.currenttitle == "o" && buttonbr1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } else if buttontr1.currenttitle == "o" && buttonm1.currenttitle == "o" && buttonbl1.currenttitle == "o" { winner.text = "player o wins!" gameover = true } // winner o } let url = nsurl(string: "http://www.sweetoothdesign.com/games-tic-tac-toe")! let request = nsurlrequest(url: url url) webview.loadrequest(request urlrequest) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. }
}
thanks
Comments
Post a Comment