Just after implementing a method for saving a users email and password from login into NSUserDefaults. My app crashes when running on iPhone 5s, but not in simulator (works as supposed).
Error message is:
dyld: Symbol not found: __TWPVSs26AutoreleasingUnsafePointerSs8_Pointer Referenced from: /private/var/mobile/Containers/Bundle/Application/76A645B8-3428-452F-AEA4-60BAF6C28819/AppName.app/AppName Expected in: /private/var/mobile/Containers/Bundle/Application/76A645B8-3428-452F-AEA4-60BAF6C28819/AppName.app/Frameworks/libswift_stdlib_core.dylib in /private/var/mobile/Containers/Bundle/Application/76A645B8-3428-452F-AEA4-60BAF6C28819/AppName.app/AppName
My NSUserDefaults code is this (don't think the rest matters):
let loggedIn = "yes"
let userDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setObject(email, forKey:"Email")
userDefaults.setObject(pw, forKey:"Password")
userDefaults.setObject(loggedIn, forKey: "LoggedIn")
userDefaults.synchronize()
This is set after user has entered email and password and the server has validated these and returned "ok".
In prepareForSegue I have this code:
let navigationController = segue.destinationViewController as UINavigationController
let vc = navigationController.viewControllers[0] as LoggedInViewController
// Gets email from saved data
let userDefaults = NSUserDefaults.standardUserDefaults()
let sendEmail: String = userDefaults.stringForKey("Email")
userDefaults.synchronize()
vc.email = sendEmail
Update:
I have gone through the crash logs and noticed this:
I dont really know how to read it but I noticed that exception code 0x0000000196442124 is at the bottom of my included image.
_dispatch_mach_msg_send + 1624
What does that mean? Does it help?
I have also marked all methods and stuff that has with NSUserDefaults (as seen above) as comments to see if they caused the problem. But the app crashes anyway..
Thanks in advance!