解包一个Optional值时出现“致命错误:意外发现nil”

时间:2015-06-11 20:18:48

标签: swift fatal-error

我在输入屏幕上构建了一个动画按钮,并尝试将动画按钮设置为故事板,但在崩溃后我一直收到此错误(fatal error: unexpectedly found nil,同时解开一个Optional值)。

这是我的代码:

//
//  ViewController.swift
//  MyChapel
//
//  Created by Kamau Exom on 6/10/15.
//  Copyright (c) 2015 SevenCreative. All rights reserved.
//

import UIKit
import WebKit

class ViewController: UIViewController {

    @IBOutlet weak var LoginLogoReveal: LogoRevealView!
    @IBOutlet weak var PhotosFade: PhotosFadeView!
    @IBOutlet weak var LoginBG: UIImageView!
    @IBOutlet weak var LoginLogo: UIImageView!
    @IBOutlet weak var LoginButton: UIButton!
    @IBOutlet weak var SignupButton: UIButton!
    @IBOutlet weak var LoginScreen: UIWebView!

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

        self.LoginLogoReveal.alpha = 1.0

        UIView.animateWithDuration(1.0, delay: 2.0, options: nil, animations: { self.LoginLogoReveal.alpha = 0
        }, completion: nil)

        self.PhotosFade.alpha = 0

        UIView.animateWithDuration(1.0, delay: 2.5, options: nil, animations: { self.PhotosFade.alpha = 1
            }, completion: nil)

        self.LoginBG.alpha = 0

        UIView.animateWithDuration(1.0, delay: 2.0, options: nil, animations: { self.LoginBG.alpha = 1
            }, completion: nil)


        self.LoginLogo.alpha = 0

        UIView.animateWithDuration(1.0, delay: 2.5, options: nil, animations: { self.LoginLogo.alpha = 1
            }, completion: nil)

        self.LoginButton.alpha = 0

        UIView.animateWithDuration(1.0, delay: 3.0, options: nil, animations: { self.LoginButton.alpha = 1
            }, completion: nil)

        self.SignupButton.alpha = 0

        UIView.animateWithDuration(1.0, delay: 3.5, options: nil, animations: { self.SignupButton.alpha = 1
            }, completion: nil)


        let loginurl = NSURL(string: "http://www.mychapel.net/?memberful_endpoint=auth")
        let request = NSURLRequest(URL: loginurl!)

        LoginScreen?.scalesPageToFit = true
        LoginScreen?.loadRequest(request)


    }

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


}

错误显示在“LoginLogoReveal.addRevealAnimation()

0 个答案:

没有答案