iOS GCM示例

时间:2016-05-18 13:01:51

标签: ios google-cloud-messaging cocoapods

我正在尝试按照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并产生相同的错误。

我之前没有Pods的经验,所以任何建议都值得赞赏。

1 个答案:

答案 0 :(得分:2)

转到路径:“/ 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安装