Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

ios - Editing locked files from a CocoaPods framework

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?

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Follow steps to do so :

  1. Find library you want to use on Git.
  2. Fork library.
  3. Update Podfile which refer to your forked version. Suppose I want to fork GPUImage Library. Then point your fork in Podfile as given.

pod 'GPUImage', :git => 'https://github.com/UserName/GPUImage.git'

  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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...