简体   繁体   English

修改xcode中的现有容器

[英]Modify existing pod in xcode

Working on a project in Xcode, I need to import a project class header in a pod class. 在Xcode中处理项目,我需要在pod类中导入项目类头。

Obviously if I use: 显然,如果我使用:

#import "MyProjectClass.h" 

fails. 失败。 Where I have to specify path? 我必须指定路径?

您不应该这样做,您应该只从您正在使用项目的pod中扩展该类,并在派生类中添加必要的更改。

Pods should not be directly edited, as any subsequent 'pod install' will wipe out your changes. 不应直接编辑窗格,因为任何后续的“窗格安装”都会删除您的更改。 As stated by rckoenes the easiest approach is to subclass the relevant class and add what you need. 正如rckoenes所述,最简单的方法是对相关类进行子类化并添加所需内容。

If the changes you need can't be done in a subclass, you have another option. 如果无法在子类中完成所需的更改,则可以使用其他选项。 You can fork the repo for the pod, make any needed changes directly to the classes themselves, and point your podfile towards your fork. 您可以为pod添加repo,直接对类本身进行任何所需的更改,并将podfile指向fork。 See this answer: Cocoapods and github forks 看到这个答案: Cocoapods和github分叉

#import "MyProjectClass.h" 

Directly import source, you should not use pods. 直接导入源,你不应该使用pods。 Better to drag the source code, and directly put into you project. 最好拖动源代码,直接放入你的项目中。

If needed modify pods and you seldom pod install , change the mode of pod file. 如果需要修改Pod,并且很少pod install ,请更改Pod文件的模式。

cd your pod folder, and run sudo chmod 777 your folder . cd你的pod文件夹,并运行sudo chmod 777 your folder

Pods folder is readonly default. Pods文件夹是只读默认值。

IMG

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM