【问题标题】:swift pod update Google Messaging generates error Use of undeclared typeswift pod update Google Messaging 生成错误 Use of undeclared type
【发布时间】:2016-09-06 20:20:28
【问题描述】:

我更新了我的项目 pod 以获取最新版本的 Google 消息传递,但现在我在构建我的项目时遇到了多个错误:

Use of undeclared type 'GGLInstanceIDDelegate'
Use of undeclared type 'GCMReceiverDelegate'
Use of unresolved identifier 'GGLContext'
Use of unresolved identifier 'GGLContext'
Use of unresolved identifier 'GCMConfig'
Use of unresolved identifier 'GCMService'
Use of unresolved identifier 'GCMPubSub'
Use of unresolved identifier 'GGLInstanceIDConfig'
Use of unresolved identifier 'GGLInstanceID'
Use of unresolved identifier 'kGGLInstanceIDRegisterAPNSOption'
Use of unresolved identifier 'kGGLInstanceIDAPNSServerTypeSandboxOption'
Use of unresolved identifier 'GGLInstanceID'
Use of unresolved identifier 'kGGLInstanceIDScopeGCM'
Use of unresolved identifier 'GCMService'
Use of unresolved identifier 'GCMService'
Use of unresolved identifier 'GGLInstanceID'Use of unresolved identifier 'kGGLInstanceIDScopeGCM'

这是pod update 命令的结果:

Analyzing dependencies
Downloading dependencies
Using GGLInstanceID (1.2.1)
Installing Google 2.0.4 (was 2.0.4)
Using GoogleCloudMessaging (1.2.0)
Using GoogleIPhoneUtilities (1.2.1)
Using GoogleInterchangeUtilities (1.2.1)
Installing GoogleMaps 2.0.1 (was 1.13.2)
Installing GoogleMobileAds (7.8.0)
Using GoogleNetworkingUtilities (1.2.1)
Using GoogleSymbolUtilities (1.1.1)
Using GoogleUtilities (1.3.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 10
total pods installed.

这是我的 podfile 的内容:

target 'myProject' do
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleMaps'
pod 'Google/CloudMessaging'

end

我尝试再次运行pod update,但结果保持不变。也许需要修改 API 入口点?

我不知道我能做什么,任何帮助将不胜感激!

【问题讨论】:

  • 您是否尝试过卸载 Google 消息 pod,然后卸载 pod install

标签: swift google-maps google-cloud-messaging cocoapods


【解决方案1】:

基于此thread,如果您遇到Use of undeclared type 'GGLInstanceIDDelegate' 错误,请确保在构建设置中添加桥头。

您必须在 Xcode Build Settings 下设置 Bridging Header “Swift Compiler Generation” -> “Objective-C Bridging Header” 喜欢 这个:

"$(SRCROOT)/$(PROJECT_NAME)/ObjCBridgingHeader.h"

您可以在其他 SO 帖子中查看我的 answer。它指出错误Use of unresolved identifier通常发生在您的新类具有与另一个不同的目标时。它可能有一个测试目标,而另一个没有。您必须在测试目标中包含所有类,或者一个都不包含。

检查这些可能有帮助的相关 SO 线程:

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    我终于找到了更新 pod 时出现这些错误的原因...

    Google 从 GCM 更新到 Firebase 并更改了他们的 API 入口点,因此我需要更改所有内容以匹配 Firebase 新的云消息传递实现!

    【讨论】:

      猜你喜欢
      • 2017-06-01
      • 1970-01-01
      • 2016-05-18
      • 2016-05-24
      • 2017-01-26
      • 1970-01-01
      • 1970-01-01
      • 2020-12-12
      • 2012-07-26
      相关资源
      最近更新 更多