我是編程新手,現在正在嘗試做一個應用程序。當我嘗試創建Google Sign登錄按鈕時,問題就開始了,當我以爲自己已經完成了這個任務時,我嘗試了模擬器,並且沒有任何按鈕在點擊時運行,甚至沒有任何按鈕可以工作。然後模擬器開始與代碼Thread 1:SIGABRT一起崩潰。我在某個地方讀過,你可以做一個豁免中斷點,看看問題出在哪裏,當我這樣做時,我來到了一些線上,其中一個線程表示線程1:斷點3.1。在模擬器上運行應用程序時,它崩潰並說線程1:斷點3.1。我該怎麼辦?
import UIKit
import Google
class ViewController: UIViewController, GIDSignInUIDelegate {
override func viewDidLoad() {
super.viewDidLoad()
GIDSignIn.sharedInstance().uiDelegate = self
// 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.
}
@IBOutlet weak var signinbutton3: GIDSignInButton!
@IBOutlet weak var signinbutton: GIDSignInButton!
func signInWillDispatch(signIn: GIDSignIn!, error: NSError!) {
}
// Present a view that prompts the user to sign in with Google
func signIn(signIn: GIDSignIn!,
presentViewController viewController: UIViewController!) {
self.present(viewController, animated: true, completion: nil)
print("Sign in presented")
}
// Dismiss the "Sign in with Google" view
func signIn(signIn: GIDSignIn!,
dismissViewController viewController: UIViewController!) {
self.dismiss(animated: true, completion: nil)
print("Sign in dismissed")
}
override func viewDidAppear(_ animated: Bool) {
self.performSegue(withIdentifier: "loginView", sender: self); //this line is where the Thread 1: Breakpoint 3.1 was.
}
}
我不久問題:
- 在模擬器上的按鈕不起作用
- 的simulatior崩潰,並顯示在Xcode的代碼序列我跟他說主題1日前顯示:SIGABRT和線程1:最後一行中的斷點3.1。
您認爲問題是什麼,我該如何解決? 編輯 嘗試啓動模擬器時我收到此:
objc [22047]:類PLBuildVersion在兩個 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/實現Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x113a45cc0)and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/系統/庫/ PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x11385c6f0)。將使用兩者之一。哪一個是未定義的。 2017-06-13 21:49:25.051 StartifyApp [22047] [Firebase/Core] [I-COR000003]配置了默認的Firebase應用程序尚未 。將[FIRApp configure]添加到您的應用程序初始化中。 2017年6月13日21:49:26.013 Startifyapp [22047:788392] *終止應用 由於未捕獲的異常 'NSInvalidArgumentException',原因: '接收機()沒有賽格瑞 與識別符 'loginView'' *先拋出調用堆棧:(0 CoreFoundation 0x000000010bf6eb0b exceptionPreprocess + 171 1 libobjc.A。dylib
0x000000010d2ab141 objc_exception_throw + 48 2的UIKit
0x000000010e00bef3 - [UIViewController中 shouldPerformSegueWithIdentifier:發送方:] + 0 3 Startifyapp
0x000000010b971fbf TFC11Startifyapp14ViewController13viewDidAppearfSbT + 127 4 Startifyapp 0x000000010b972021 TToFC11Startifyapp14ViewController13viewDidAppearfSbT + 49 5的UIKit 0x000000010e00ecae - [UIViewController中_setViewAppearState:isAnimating:] + 704 6 UIKit 0x000000010e00f6d4 - [UIViewController _endAppearanceTransition:] + 197 7 UIKit 0x000000010 dfe1f94 - [UIPresentationController transitionDidFinish:] + 868 8的UIKit 0x000000010e1f6525 - [_ UICurrentContextPresentationController transitionDidFinish:] + 44 9的UIKit
0x000000010dfe5af6 __56- [UIPresentationController runTransitionForCurrentState] _block_invoke_2 + 183 10的UIKit
0x000000010e995d1c - [_ UIViewControllerTransitionContext completeTransition:] + 102 11的UIKit
0x000000010dfdeec0 - [UITransitionView notifyDidCompleteTransition:] + 251 12的UIKit 0x000000010dfdeb38 - [UITransitionView _didCompleteTransition:] + 1408 13的UIKit 0x000000010dfe1208 - [UITransitionView _transitionDidStop:完成:] + 104 14的UIKit 0x000000010def2257 - [UIViewAnimationState sendDelegateAnimationDidStop:完成:] + 222 15的UIKit 0x000000010def2796 - [UIViewAnimationState animationDidStop:完成:] + 136 16 QuartzCore 0x00000001151a968e _ZN2CA5Layer23run_animation_callbacksEPv + 306 17 libdispatch.dylib 0x00000001100f305c _dispatch_client_callout + 8 18 libdispatch.dylib 0x00000001100d440b _dispatch_main_queue_callback_4CF + 411 19 的CoreFoundation 0x000000010bf33909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 20的CoreFoundation 0x000000010bef9ae4 __CFRunLoopRun + 2164 21的CoreFoundation 0x000000010bef9016 CFRunLoopRunSpecific + 406個22 GraphicsServices
0x0000000111775a24 GSEventRunModal + 62 23的UIKit
0x000000010de66134 UIApplicationMain + 159 24 Startifyapp
0x000000010b9700d7主+ 55 25 libdyld.dylib
0x000000011013f65d啓動+ 1 26 ???
0x0000000000000001爲0x0 + 1)的libC++ abi.dylib:與類型NSException(LLDB的 未捕獲的異常)
您確定,您的segue在InterfaceBuilder中有正確的名稱嗎?另外,你爲什麼要在viewDidAppear中執行segue? –
不要忘記調用'super.viewDidAppear()'。 – shallowThought
我在ViewController中有segue,因爲那是Google開發者告訴我的。我使用override func viewDidAppear在視圖控制器中粘貼了super.viewDidAppear(),但它給了紅色的警告標誌。我應該把它放在哪裏? –