gpt4 book ai didi

objective-c - 通过 CocoaPods 在 github 上使用 Restkit 的分支?

转载 作者:IT王子 更新时间:2023-10-29 07:46:14 26 4
gpt4 key购买 nike

restkit 以不同的方式使用 oauth2 协议(protocol),我需要更改代码才能以我的方式使用它:

来自:

// OAuth 2 valid request
if (self.authenticationType == RKRequestAuthenticationTypeOAuth2) {
NSString *authorizationString = [NSString stringWithFormat:@"OAuth2 %@", self.OAuth2AccessToken];
[_URLRequest setValue:authorizationString forHTTPHeaderField:@"Authorization"];
}

到:

// OAuth 2 valid request
if (self.authenticationType == RKRequestAuthenticationTypeOAuth2) {
NSString *authorizationString = [NSString stringWithFormat:@"Bearer %@", self.OAuth2AccessToken];
[_URLRequest setValue:authorizationString forHTTPHeaderField:@"Authorization"];
}

使用“Bearer”代替“Oauth2”....

我正在使用 CocoaPods 在我的项目中导入 restkit。

我可以在 github 上 fork Restkit 存储库并通过 CocoaPod 使用 fork 而不是官方版本吗?

最佳答案

当然可以。看看https://github.com/CocoaPods/CocoaPods/wiki/Dependency-declaration-options

如果 RestKit 将其 .podspec 文件包含在存储库中,那么您只需将 Podfile 更改为指向您的 fork,即

pod 'RestKit', :git => 'https://github.com/you/RestKit.git'

不幸的是,RestKit 不包含它的 .podspec。而是从 https://github.com/CocoaPods/Specs/blob/master/RestKit/0.10.2/RestKit.podspec 复制 RestKit.podspec并将其添加到您的项目中。编辑 .podspec 以使用您的分支作为其来源。然后,您可以在 Podfile 中指定本地 .podspec:

pod 'RestKit', :podspec => 'local/path/to/RestKit.podspec'

或者,您可以将此 .podspec 添加到您的 fork 中并使用之前的依赖声明。

关于objective-c - 通过 CocoaPods 在 github 上使用 Restkit 的分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12393470/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com