从CocoaPods框架编辑锁定的文件 [英] Editing locked files from a CocoaPods framework

查看:117
本文介绍了从CocoaPods框架编辑锁定的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Xcode工作区,它使用CocoaPods来包含几个第三方框架。我想在其中一个依赖项中编辑一行源代码。但是,当我这样做时,Xcode警告我文件被锁定,并且我所做的任何更改都可能无法保存。所以我的问题是:当我运行pod安装/更新时,我的源代码更改会被丢弃吗?如果没有,是否有任何其他可能与CocoaPods无关的情况会丢弃我的更改?最后,有没有什么好方法可以编辑源代码而不会遇到这样的问题?

I have an Xcode workspace that uses CocoaPods to include several third-party frameworks. I would like to edit a line of source code within one of these dependencies. However, when I do so, Xcode warns me that the file is locked and that any changes I make may not be saved. So my question is: will my changes to the source code be discarded when I run a pod install/update? If not, is there any other scenario, possibly unrelated to CocoaPods, that would discard my changes? And finally, is there any good way that I can edit the source code without running into such problems?

提前致谢。

推荐答案

您无法在Original Pod文件中进行更改。如果你想添加更多的功能,那么你必须分叉该特定的回购。

You can not make changes in Original Pod file. If you want to add some more features then you have to fork that particular repo.

按照以下步骤进行:


  1. 在Git上查找要使用的库。

  2. Fork库。

  3. 更新Podfile,引用你的分叉版。
    假设我想要分叉GPUImage库。然后将你的fork指向Podfile给定。




pod'GPUImage',:git =>'< a href =https://github.com/UserName/GPUImage.git =noreferrer> https://github.com/UserName/GPUImage.git '




  1. 进行更改。

  2. 提交/推送您的更改到您的分叉repo。

  3. 向图书馆的原作者提交拉取请求。

  4. 如果接受拉取请求并更新窗格,请恢复您的Podfile使用公共pod。

  1. Make your changes.
  2. Commit/push your changes to your forked repo.
  3. Submit a pull request to the original author of Library.
  4. If pull request is accepted and the pod is updated, revert back your Podfile to use the public pod.

您可以创建类别(目标C)或扩展(Swift)来扩展或添加现有功能class。

You can create Category (Objective C) or Extension (Swift) to extend or add some features to existing class.

这篇关于从CocoaPods框架编辑锁定的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆