ios - 代码错误 : "Use of unresolved identifier: GGLContext" (without CocoaPods)

标签 ios xcode swift google-signin

我从事 Web 开发已有几年,这是我的第一个 iOS 应用程序项目。我已按照 Google 的 Get the Google Sign-in SDK for iOS 中的所有说明进行操作(没有 CocoaPods),我尝试模拟应用程序,但出现此错误:Use of unresolved identifier 'GGLContext'

这是从 Google 页面复制并放入 AppDelegate.swift 的代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  // Override point for customization after application launch.
  // Initialize Google sign-in
  var configureError: NSError?
  GGLContext.sharedInstance().configureWithError(&configureError)  // THIS LINE HAS THE ERROR
  assert(configureError == nil, "Error configuring Google services: \(configureError)")

  //GIDSignIn.sharedInstance().delegate = self
  GIDSignIn.sharedInstance().clientID = MY_CLIENT_ID

        return true
    }

有什么帮助吗?

最佳答案

我遇到了和你一样的问题然后我决定阅读 Google's Tutorial再次寻找“手动”一词,他们是这样说的:

Note: If you manually installed the SDK, you should instead configure the GIDSignIn object directly, using the client ID found in the GoogleService-Info.plist file:

GIDSignIn.sharedInstance().clientID = kClientID

所以只需注释与 GGLContext 相关的行,我认为这应该可以解决这个问题。

关于ios - 代码错误 : "Use of unresolved identifier: GGLContext" (without CocoaPods),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37733373/

相关文章:

ios - 应用程序委托(delegate)中的代码与 View Controller

ios - Swift 中的自定义 map

ios - 在 iOS 上插入耳机时内置麦克风的输入声音会降低

ios - 未找到 <GoogleMaps/GoogleMaps.h> 文件 Google Maps SDK for iOS

ios - 如何在点击PresentationLink (SwiftUI) 时禁用闪烁?

ios - 显示 RootController 的 TabBar 项目 - 容器嵌入式 NavigationController TableViewController 堆栈

swift - MapKit 错误 : NSHostingView is being laid out reentrantly while rendering its SwiftUI content

iOS Crittercism - 禁用网络数据收集

iphone - 我可以在没有源代码的情况下将应用程序安装到模拟器吗?

ios - 应用程序在 iPhone 上运行时崩溃,以违规为异常(exception)