This below is the code I used. Can anyone help me to solve this problem?
AppDelegate.swift
import UIKit
import CoreData
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
return true
}
....
}
ViewController.swift
import UIKit
import Firebase
class ViewController: UIViewController {
@IBOutlet var Username: UITextField!
@IBOutlet var Password: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func CreateAccount(_ sender: AnyObject) {
FIRAuth.auth()?.createUser(withEmail: Username.text!, password: Password.text!, completion: {
user, error in
if error != nil{
self.login()
}
else{
print("User Created")
self.login()
}
})
}
func login(){
FIRAuth.auth()?.createUser(withEmail: Username.text!, password: Password.text!, completion: {
user, error in
if error != nil{
print("Incorrect")
}
else{
print("OK")
}
})
}
}
2016-09-18 23:25:22.601079 UserLogin[1613:81920] subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.602525 UserLogin[1613:81920] subsystem: com.apple.UIKit, category: HIDEventIncoming, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.615489 UserLogin[1613:81918] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 1, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, enable_private_data: 0
2016-09-18 23:25:22.632130 UserLogin[1613:81884] subsystem: com.apple.UIKit, category: StatusBar, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.655849 UserLogin[1613:81884] subsystem: com.apple.SystemConfiguration, category: SCNetworkReachability, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.657839 UserLogin[1613:81884] subsystem: com.apple.network, category: , enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.658172 UserLogin[1613:81884] [] nw_resolver_create_dns_service_on_queue Starting host resolution app-measurement.com:0, flags 0x4000d000
2016-09-18 23:25:22.658 UserLogin[1613:81884] Configuring the default app.
2016-09-18 23:25:22.658981 UserLogin[1613:81922] [] nw_resolver_host_resolve_callback flags=0x3 ifindex=0 error=NoSuchRecord(-65554) hostname=app-measurement.com. addr=::.0 ttl=60
2016-09-18 23:25:22.659724 UserLogin[1613:81922] [] nw_resolver_host_resolve_callback flags=0x2 ifindex=0 error=NoError(0) hostname=app-measurement.com. addr=216.58.221.142:0 ttl=247
2016-09-18 23:25:22.685692 UserLogin[1613:81884] subsystem: com.apple.securityd, category: OSStatus, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.686: <FIRInstanceID/WARNING> Failed to remove checkin auth credentials from Keychain Error Domain=com.google.iid Code=-34018 "(null)"
2016-09-18 23:25:22.690: <FIRInstanceID/WARNING> Error failed to remove all tokens from keychain Error Domain=com.google.iid Code=-34018 "(null)"
2016-09-18 23:25:22.691: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-09-18 23:25:22.692339 UserLogin[1613:81919] [] tcp_connection_create_with_endpoint_and_parameters 1 play.googleapis.com 443
2016-09-18 23:25:22.693333 UserLogin[1613:81919] [] tcp_connection_start 1 starting
2016-09-18 23:25:22.694450 UserLogin[1613:81919] [] nw_connection_create creating connection to play.googleapis.com:443
2016-09-18 23:25:22.695570 UserLogin[1613:81919] [] tcp_connection_start starting tc_nwconn=0x7fde33d0d4e0
2016-09-18 23:25:22.695688 UserLogin[1613:81921] subsystem: com.apple.libsqlite3, category: logging, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0
2016-09-18 23:25:22.696348 UserLogin[1613:81919] [] __nw_connection_start_block_invoke 1 starting
2016-09-18 23:25:22.725488 UserLogin[1613:81919] [] nw_endpoint_handler_start [1 play.googleapis.com:443 initial path (null)]
2016-09-18 23:25:22.727001 UserLogin[1613:81918] [] tcp_connection_create_with_endpoint_and_parameters 2 device-provisioning.googleapis.com 443
2016-09-18 23:25:22.728774 UserLogin[1613:81919] [] nw_connection_endpoint_report [1 play.googleapis.com:443 initial path (null)] reported event path:start
2016-09-18 23:25:22.729161 UserLogin[1613:81918] [] tcp_connection_start 2 starting
2016-09-18 23:25:22.729789 UserLogin[1613:81918] [] nw_connection_create creating connection to device-provisioning.googleapis.com:443
2016-09-18 23:25:22.731118 UserLogin[1613:81919] [] nw_endpoint_handler_path_change [1 play.googleapis.com:443 waiting path (satisfied)]
2016-09-18 23:25:22.731 UserLogin[1613:81884] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UserLogin.ViewController 0x7fde33c08950> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key UserName.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104cdb34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010431f21e objc_exception_throw + 48
2 CoreFoundation 0x0000000104cdb299 -[NSException raise] + 9
3 Foundation 0x0000000103e2f2ff -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x00000001052988c3 -[UIViewController setValue:forKey:] + 88
5 UIKit 0x000000010550cbe6 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000104c80590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x000000010550b56a -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x000000010529eff5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x000000010529f917 -[UIViewController loadView] + 177
10 UIKit 0x000000010529fc4c -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x00000001052a04a0 -[UIViewController view] + 27
12 UIKit 0x000000010516a045 -[UIWindow addRootViewControllerViewIfPossible] + 71
13 UIKit 0x000000010516a796 -[UIWindow _setHidden:forced:] + 293
14 UIKit 0x000000010517e0a9 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x00000001050f7259 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
16 UIKit 0x00000001050fd3b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
17 UIKit 0x00000001050fa539 -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x000000010a1dd76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
19 FrontBoardServices 0x000000010a1dd5e4 -[FBSSerialQueue _performNext] + 189
20 FrontBoardServices 0x000000010a1dd96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x0000000104c80311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x0000000104c6559c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x0000000104c64a86 __CFRunLoopRun + 918
24 CoreFoundation 0x0000000104c64494 CFRunLoopRunSpecific + 420
25 UIKit 0x00000001050f8db6 -[UIApplication _run] + 434
26 UIKit 0x00000001050fef34 UIApplicationMain + 159
27 UserLogin 0x0000000102f97bbf main + 111
28 libdyld.dylib 0x000000010733a68d start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
2016-09-18 23:25:22.731704 UserLogin[1613:81918] [] tcp_connection_start starting tc_nwconn=0x7fde33e0a120
(lldb) c
See Question&Answers more detail:
os