【问题标题】:Invalid Podfile for iOS GCM ExampleiOS GCM 示例的无效 Podfile
【发布时间】:2016-09-14 23:44:07
【问题描述】:

我正在尝试按照 Google 开发人员页面上的说明安装 GCM 示例 Xcode 项目 https://developers.google.com/cloud-messaging/ios/start

但在第 1 步失败并显示此消息:

[!] Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead..

完整的成绩单是这样的:

$ pod try Google --no-repo-update

Trying Google
1: Samples/admob/AdMobExample.xcodeproj
2: Samples/analytics/AnalyticsExample.xcodeproj
3: Samples/appinvites/AppInvitesExample.xcodeproj
4: Samples/gcm/GcmExample.xcodeproj
5: Samples/signin/SignInExample.xcodeproj
Which project would you like to open
4
Performing CocoaPods Installation

[!] Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead..

 #  from /private/var/folders/d5/f4qpz1r530xbw5cyrbfk094h0000gp/T/CocoaPods/Try/Google/Samples/gcm/Podfile:10
 #  -------------------------------------------
 #  # and delete the link_with command.
 >  link_with 'GcmExample', 'GcmExampleSwift'
 #  ------------------------------------------

我已尝试按照错误消息中的建议修改 podfile,但即使使用 --no-repo-update option 运行并产生相同的错误,也会重新生成 Podfile。

我之前没有使用 Pod 的经验,因此欢迎提出任何建议。

【问题讨论】:

    标签: ios google-cloud-messaging cocoapods


    【解决方案1】:

    转到路径:“/private/var/folders/lx/78jh00l90p95cs1cy_545t2r0000gn/T/CocoaPods/Try/Google/Samples/gcm”然后只需打开 pod 文件并将其更新为

    # GcmExample
     target 'GcmExample' do
      platform :ios, '7.0'
       pod 'Google/CloudMessaging'
    end
    # If using CocoaPods 1.0.0+, use the new target syntax.
    #target 'GcmExample'
    #target 'GcmExampleSwift'
    
    # and delete the link_with command.
    #link_with 'GcmExample', 'GcmExampleSwift'
    

    然后,pod 安装

    【讨论】:

    • 谢谢马赫什。除了您的建议之外,我还取消了 podfile 中“目标”行的注释(在您的答案中进行了编辑),然后安装成功。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-17
    • 1970-01-01
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    相关资源
    最近更新 更多