2017-06-13 66 views
0

我是编程新手,现在正在尝试做一个应用程序。当我尝试创建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的 未捕获的异常)

+0

您确定,您的segue在InterfaceBuilder中有正确的名称吗?另外,你为什么要在viewDidAppear中执行segue? –

+0

不要忘记调用'super.viewDidAppear()'。 – shallowThought

+0

我在ViewController中有segue,因为那是Google开发者告诉我的。我使用override func viewDidAppear在视图控制器中粘贴了super.viewDidAppear(),但它给了红色的警告标志。我应该把它放在哪里? –

回答

0

我有同样的问题在Xcode 9和模拟器终止。 我使用了iOS 11的真实设备,它工作正常(虽然有一些错误)

相关问题