问题
I am trying to install the GCM Example Xcode project, following the instructions on the Google developers page https://developers.google.com/cloud-messaging/ios/start
but failing at step 1 with this message:
[!] Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead..
The full transcript goes like this:
$ 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'
# ------------------------------------------
I have tried modifying the podfile as suggested in the error message, but the Podfile is regenerated, even when run with the --no-repo-update option
and produces the same error.
I have no prior experience with Pods so any suggestions appreciated.
回答1:
Go to the path: "/private/var/folders/lx/78jh00l90p95cs1cy_545t2r0000gn/T/CocoaPods/Try/Google/Samples/gcm" then just open the pod file and update it as
# 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'
Then, pod install
来源:https://stackoverflow.com/questions/37300439/invalid-podfile-for-ios-gcm-example