swift fatal error: unexpectedly found nil while unwrapping an Optional value(lldb)from email -in my code?
swift fatal error: unexpectedly found nil while unwrapping an Optional value(lldb)from email -in my code?
这是我的代码,在这里找到了致命的 error.i 尝试解决这个问题,但它显示了很多次,并且显示了 EXC_BAD_INSTRUCTION(code=EXC_i386_INVOP,subcode= 0*0)
import UIKit
class VerifyProfileViewController: UIViewController,UITextFieldDelegate,FBLoginViewDelegate {
var liveurl = demo_url
@IBOutlet weak var f_name: UITextField!
@IBOutlet weak var l_name: UITextField!
@IBOutlet weak var email_id: UITextField!
@IBOutlet weak var mobilenumber: UITextField!
@IBOutlet weak var myLabel: UILabel!
@IBOutlet weak var nextOutlet: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// NSUserDefaults.standardUserDefaults().synchronize()
var mobile_Number = mobilenumber.text
var email_Address = email_id.text
var first_name = f_name.text
var last_name = l_name.text
var email1 = isValidEmail(email_Address)
let email = NSUserDefaults.standardUserDefaults().objectForKey("fb_email") as NSString
println("The email :\(email)")
let first_name = NSUserDefaults.standardUserDefaults().objectForKey("fb_name") as NSString
println("The firstname :\(first_name)")
let last_name = NSUserDefaults.standardUserDefaults().objectForKey("fb_lname") as NSString
println("The firstname :\(last_name)")
//NSUserDefaults.standardUserDefaults().setObject(facebookid, forKey:"id")
//let facebook_id = NSUserDefaults.standardUserDefaults().objectForKey("fb_id")! as NSString
//println("The fbID :\(facebook_id)")
email_id.text = email
f_name.text = first_name
l_name.text = last_name
NSUserDefaults.standardUserDefaults().setValue("abc@def.com", forKey: "fb_email")
if let email = NSUserDefaults.standardUserDefaults().stringForKey("fb_email") {
println(email)
}
这是我的代码,在这里找到了致命的 error.i 尝试解决这个问题,但它显示了很多次,并且显示了 EXC_BAD_INSTRUCTION(code=EXC_i386_INVOP,subcode= 0*0)
import UIKit
class VerifyProfileViewController: UIViewController,UITextFieldDelegate,FBLoginViewDelegate {
var liveurl = demo_url
@IBOutlet weak var f_name: UITextField!
@IBOutlet weak var l_name: UITextField!
@IBOutlet weak var email_id: UITextField!
@IBOutlet weak var mobilenumber: UITextField!
@IBOutlet weak var myLabel: UILabel!
@IBOutlet weak var nextOutlet: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// NSUserDefaults.standardUserDefaults().synchronize()
var mobile_Number = mobilenumber.text
var email_Address = email_id.text
var first_name = f_name.text
var last_name = l_name.text
var email1 = isValidEmail(email_Address)
let email = NSUserDefaults.standardUserDefaults().objectForKey("fb_email") as NSString
println("The email :\(email)")
let first_name = NSUserDefaults.standardUserDefaults().objectForKey("fb_name") as NSString
println("The firstname :\(first_name)")
let last_name = NSUserDefaults.standardUserDefaults().objectForKey("fb_lname") as NSString
println("The firstname :\(last_name)")
//NSUserDefaults.standardUserDefaults().setObject(facebookid, forKey:"id")
//let facebook_id = NSUserDefaults.standardUserDefaults().objectForKey("fb_id")! as NSString
//println("The fbID :\(facebook_id)")
email_id.text = email
f_name.text = first_name
l_name.text = last_name
NSUserDefaults.standardUserDefaults().setValue("abc@def.com", forKey: "fb_email")
if let email = NSUserDefaults.standardUserDefaults().stringForKey("fb_email") {
println(email)
}