Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 有人能帮我们解决这些Xcode错误吗?_Ios_Swift_Xcode - Fatal编程技术网

Ios 有人能帮我们解决这些Xcode错误吗?

Ios 有人能帮我们解决这些Xcode错误吗?,ios,swift,xcode,Ios,Swift,Xcode,我正在尝试为我的教堂制作一个应用程序,我正在观看一系列YT教程,但我遇到了很多错误: 欢迎来到SO:)下次请在问题中发布您的代码,您也可以嵌入您的图像文件,以帮助我们更轻松地查看您的问题 您忘记添加“:” 网站(发件人:AnyObject) 在下一行,您将“{”一行放得太远了。它需要放在if语句的末尾,而不是在UIApplication.sharedApplication之后…… 还有一些其他的标点错误 当你看到一个错误说“override只能在类中使用”时,这通常意味着你忘记了某个右括号(你忘

我正在尝试为我的教堂制作一个应用程序,我正在观看一系列YT教程,但我遇到了很多错误:

欢迎来到SO:)下次请在问题中发布您的代码,您也可以嵌入您的图像文件,以帮助我们更轻松地查看您的问题

您忘记添加“:”
网站(发件人:AnyObject)

在下一行,您将“{”一行放得太远了。它需要放在if语句的末尾,而不是在
UIApplication.sharedApplication之后……

还有一些其他的标点错误

当你看到一个错误说“override只能在类中使用”时,这通常意味着你忘记了某个右括号(你忘记了)。你可以选择整个程序,然后执行“编辑器->结构->重新缩进”,这将帮助你看到作用域问题在哪里(这是我修复override问题的方式)

一定要阅读并注意你的错误信息。其中一条会清楚地告诉你,你在if语句后缺少“{”,当你看到“预期表达式”时,这意味着你写的东西对Swift来说都是胡言乱语(这意味着你很可能是打字错误,或者留下了一些不完整的东西)

我继续为您编辑了您的问题,并修复了您的代码。我几乎没有使用您正在使用的任何东西(我编写了游戏),但我只是按照Xcode给我的说明(中间带点的说明告诉您如何修复它):

此外,这似乎是较旧的Swift代码,因此您会遇到错误。请尝试查找用Swift 3编写的教程(或下载较旧的Xcode)

教程很棒,但它们很少教你如何解决问题。这时你必须依赖调试器和Xcode错误。请尝试在此处搜索你的错误,如果你仍然难以解决,那么你可以随时发布一个问题:p


祝你的应用好运!

Stackoverflow不是你的个人帮助台。请阅读。非常感谢!我收到了和arror,还有一个黄色错误,FIRAuth.auth一直说它已重命名为auth,但如果我使用auth.auth,它说不能对“auth”类型的可选值使用可选链接黄色错误指向顶部UIApplication.shared.openURL有一个错误,它说请使用openURL:options:completionHandler:代替,但idk这意味着什么我没有firebase,所以我无法帮助。尝试搜索答案,如果你找不到答案,然后用firebase标签发布一个新问题,这样人们可以帮助:P@PanDu嗯
import UIKit
import Firebase

class ViewController: UIViewController {
  @IBOutlet weak var emailField: UITextField!
  @IBOutlet weak var passwordField: UITextField!
  @IBOutlet weak var myWebView: UIWebView!

  @IBAction func Website(sender AnyObject) {

    if let url = NSURL(string: :"http://www.sermonaudio.com/source_detail.asp?sourceid=cfbc1")
    UIApplication.sharedApplication().openURL(url) {
    }

    var userUid: String!

    override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.

      getVideo(videoCode: "qS6tvqL1N24")
    }

    override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
    }

    func goToCreateUserVC(){
      performSegue(withIdentifier: "Feed", sender: nil)
    }
    func goToFeedVC() {
      performSegue(withIdentifier: "Feed", sender: nil)
    }
    func getVideo(videoCode:String!)
    {
      let url = URL(string: "https://www.youtube.com/embed/\(videoCode)")
      myWebView.loadRequest(URLRequest(url: url!))
    }
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "SignUp" {
        if let destination = segue.destination as? UserVC {
          if userUid != nil {
            destination.userUid = userUid
          }
          if emailField.text != nil {
            destination.emailField = emailField.text
          }
          if passwordField.text != nil {
            destination.passwordField = passwordField.text
          }
        }
      }
    }

    @IBAction func signInTapped(_ sender: Any){
      if let email = emailField.text, let password = passwordField.text {
        FIRAuth.auth()?.signIn(withEmail: email, password: password, completion:
          { (user,error) in
            if error == nil {
              if let user = user {
                self.userUid = user.uid
                self.goSignUpVC()
              }
            } else {
              self.goToCreateUserVC()
            }
        });
      }
    }
  }

}
class ViewController: UIViewController {
  @IBOutlet weak var emailField: UITextField!
  @IBOutlet weak var passwordField: UITextField!
  @IBOutlet weak var myWebView: UIWebView!

  @IBAction func Website(sender: AnyObject) {

    if let url = URL(string: "http://www.sermonaudio.com/source_detail.asp?sourceid=cfbc1") {
      UIApplication.shared.openURL(url)
    }
  }
  var userUid: String!

  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    getVideo(videoCode: "qS6tvqL1N24")
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }

  func goToCreateUserVC(){
    performSegue(withIdentifier: "Feed", sender: nil)
  }
  func goToFeedVC() {
    performSegue(withIdentifier: "Feed", sender: nil)
  }
  func getVideo(videoCode:String!)
  {
    let url = URL(string: "https://www.youtube.com/embed/\(videoCode)")
    myWebView.loadRequest(URLRequest(url: url!))
  }
  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "SignUp" {
      if let destination = segue.destination as? UserVC {
        if userUid != nil {
          destination.userUid = userUid
        }
        if emailField.text != nil {
          destination.emailField = emailField.text
        }
        if passwordField.text != nil {
          destination.passwordField = passwordField.text
        }
      }
    }
  }

  @IBAction func signInTapped(_ sender: Any){
    if let email = emailField.text, let password = passwordField.text {
      FIRAuth.auth()?.signIn(withEmail: email, password: password, completion:
        { (user,error) in
          if error == nil {
            if let user = user {
              self.userUid = user.uid
              self.goSignUpVC()
            }
          } else {
            self.goToCreateUserVC()
          }
      });
    }
  }
}