通过CocoaPods在github上使用Restkit的fork? [英] Use a fork of Restkit on github via CocoaPods?
问题描述
restkit以不同的方式使用oauth2协议,我需要更改代码以便能够以我的方式使用它:
restkit is using in a different way the oauth2 protocol, I need to change the code to be able to use it in my way:
来自:
// OAuth 2 valid request
if (self.authenticationType == RKRequestAuthenticationTypeOAuth2) {
NSString *authorizationString = [NSString stringWithFormat:@"OAuth2 %@", self.OAuth2AccessToken];
[_URLRequest setValue:authorizationString forHTTPHeaderField:@"Authorization"];
}
to:
// OAuth 2 valid request
if (self.authenticationType == RKRequestAuthenticationTypeOAuth2) {
NSString *authorizationString = [NSString stringWithFormat:@"Bearer %@", self.OAuth2AccessToken];
[_URLRequest setValue:authorizationString forHTTPHeaderField:@"Authorization"];
}
使用Bearer代替Oauth2....
Use of "Bearer" instead of "Oauth2" ....
我正在使用CocoaPods在我的项目中导入restkit。
I'm using CocoaPods to import restkit in my project.
我可以在github上分叉Restkit存储库并使用通过CocoaPod代替官方版本?
Can I fork Restkit repository on github and use the fork via CocoaPod instead of the official version?
推荐答案
你当然可以。请查看 https://github.com/CocoaPods/CocoaPods/wiki/Dependency-declaration-options
如果RestKit在存储库中包含其 .podspec
文件,那么您只需更改 Podfile
指向你的分叉即
If RestKit included its .podspec
file in the repository then you could just change your Podfile
to point to your fork i.e.
pod 'RestKit', :git => 'https://github.com/you/RestKit.git'
不幸的是RestKit不包括它 .podspec
。而是从 RestKit.podspec > https://github.com/CocoaPods/Specs/blob/master/RestKit/0.10.2/RestKit.podspec 并将其添加到您的项目中。编辑 .podspec
以使用fork作为其源。然后,您可以在 Podfile
中指定本地 .podspec
:
Unfortunately RestKit does not include its .podspec
. Instead copy RestKit.podspec
from https://github.com/CocoaPods/Specs/blob/master/RestKit/0.10.2/RestKit.podspec and add it to your project. Edit the .podspec
to use your fork as its source. You can then specify a local .podspec
in your Podfile
:
pod 'RestKit', :podspec => 'local/path/to/RestKit.podspec'
或者你可以添加这个 .podspec
到你的fork并使用前一个依赖声明。
Alternately you might just add this .podspec
to your fork and use the former dependency declaration.
这篇关于通过CocoaPods在github上使用Restkit的fork?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!