【问题标题】:GcmExample.xcodeproj sample app not found in pod在 pod 中找不到 GcmExample.xcodeproj 示例应用程序
【发布时间】:2016-09-22 12:42:01
【问题描述】:

我正在关注Google Cloud Messaging for iOS 的官方指南:

从终端使用以下命令开始示例:

pod 试试谷歌

从提示中选择 GcmExample.xcodeproj 选项。

但这是我的控制台输出:

pod try Google

Updating spec repositories

Trying Google
1: Samples/analytics/AnalyticsExample.xcodeproj
2: Samples/signin/SignInExample.xcodeproj
Which project would you like to open

GcmExample 根本没有选项。

【问题讨论】:

    标签: ios google-cloud-messaging cocoapods


    【解决方案1】:

    我也找不到这个目录, 我的解决方案是 启动你的终端并点击 ->

    ->cd yourCloningDirectory
    ->git clone https://github.com/googlesamples/google-services.git
    

    然后在克隆或下载后

    ->cd google-services(downloaded directory)->ios->gcm->
    

    这是您的 GCMExample.xcodeproj

    ->pod install
    

    (如果安装失败/找不到 repo,尝试更新 Podfile 像

    来源'https://github.com/CocoaPods/Specs.git'

    pod 'Google/CloudMessaging')

    ->open GCMExample.xcworkspace
    

    这是您的工作演示项目。

    【讨论】:

    • 感谢您的解决方案
    【解决方案2】:

    新版本的 Google Cloud Messaging (GCM) 是 Firebase Cloud Messaging (FCM)。新代码应使用 Firebase pod 而不是 Google pod。对于 FCM 示例,您可以这样做

    pod try Firebase
    

    然后从列表中选择Samples/messaging/FCM.xcodeproj

    【讨论】:

    • GCM 尚未被弃用,它仍将像以前一样工作。但是它不在 Google 试用项目列表中。您应该通过 pod try Firebase 尝试 FCM。
    • 我已经在后端和 Android 应用上实现了 GCM。我完全属于 GCM。我负担不起切换到 Firebase 的费用。致谷歌:你在 2012 年发布了 GCM,请不要这么快就弃用它,这样搞砸我。
    • @Myothercarisacadr:FCM 和 GCM 的 API 非常相似,应该很容易更改。或者,您可以查看podspec for Google 2.0.4(删除所有服务之前的上一个版本),从那里的 URL 手动下载包,然后查看其中的 Samples 目录。
    猜你喜欢
    • 1970-01-01
    • 2020-12-29
    • 1970-01-01
    • 2013-07-16
    • 2013-08-18
    • 2015-12-02
    • 2018-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多