Я не получаю страницу входа в Google после нажатия кнопки входа.
Я получаю эту ошибку:
Не удалось создать прокси удаленного объекта: Ошибка домена= NSCocoaErrorDomain Code = 4099 "Соединение с сервисом с именем com.apple.commcenter.coretelephony.xpc недействительно."UserInfo = {NSDebugDescription = Соединение с сервисом с именем com.apple.commcenter.coretelephony.xpc было недействительным.}
Я использовал этот код в действии кнопки, чтобы открыть вход в Google. Пожалуйста, предложите мнедвигаться дальше.Заранее спасибо.
import UIKit
import Google
import GoogleSignIn
import GGLSignIn
class LoginCell: UITableViewCell, UITextFieldDelegate, GIDSignInUIDelegate, GIDSignInDelegate {
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if (error == nil) {
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
print("User id is \(userId)")
let idToken = user.authentication.idToken // Safe to send to the server
print("Authentication idToken is \(idToken)")
let fullName = user.profile.name
print("User full name is \(fullName)")
let givenName = user.profile.givenName
print("User given profile name is \(givenName)")
let familyName = user.profile.familyName
print("User family name is \(familyName)")
let email = user.profile.email
print("User email address is \(email)")
// ...
} else {
print("ERROR ::\(error.localizedDescription)")
}
}
// Finished disconnecting |user| from the app successfully if |error| is |nil|.
public func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!)
{
}
func sign(inWillDispatch signIn: GIDSignIn!, error: Error!) {
guard error == nil else {
print("Error while trying to redirect : \(String(describing: error))")
return
}
print("Successful Redirection")
}
func sign(_ signIn: GIDSignIn!, dismiss viewController: UIViewController!) {
print("dismissing Google SignIn")
}
func sign(_ signIn: GIDSignIn!, present viewController: UIViewController!) {
print("presenting Google SignIn")
}
@IBOutlet weak var signInButton: UIButton!
//MARK: - Delegate
weak var delegate: CustomDelegate?
//Appdelegate
static func shared() -> AppDelegate {
return UIApplication.shared.delegate as! AppDelegate
}
//MARK: - UIVIEW CONTROLLER LIFE CYCLE
override func awakeFromNib() {
super.awakeFromNib()
//MARK: - Google
GIDSignIn.sharedInstance()?.uiDelegate = self
GIDSignIn.sharedInstance().delegate = self
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(indexPath: IndexPath) {
}
// //MARK: - Google Signin Delegate
//
//MARK: - Button Actions
@IBAction func doPressGoogleSign(in sender: Any) {
//Check social network type
GIDSignIn.sharedInstance().signOut() //Need to check
AppDelegate.shared().loginType = kGooglePlus
//Show Progress Bar once connection is initiated
//MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
//hud.labelText = @"Loading";
let googleButton = GIDSignInButton()
GIDSignIn.sharedInstance().shouldFetchBasicProfile = true
googleButton.sendActions(for: .touchUpInside)
}
}