Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will `pod update` overwrite my code changes when a new version of the pod is available?

I've added MKStoreKit version 4.99 to my project using cocoapods. My Podfile consists of:

platform :ios, '6.0'
pod 'MKStoreKit', '~> 4.99'

MKStoreKit has a configuration file called MKStoreKitConfigs.h that needs to be modified on a per-project basis, and I've modified the file appropriately. What will happen when MKStoreKit releases a new version, say 5.0, and I execute pod update? Will my changes be overwritten? Could you describe why yes or why no?

like image 462
Jon Avatar asked May 17 '13 16:05

Jon


2 Answers

Yes, pod update will overwrite your changes. What you could do is fork the project on Github make the changes in your fork and point Cocoapods to the fork. See Use a fork of Restkit on github via cocoaPod? on how to do that.

like image 166
Marcel Avatar answered Sep 18 '22 12:09

Marcel


As I understand it's a known problem and also as one said: "this is kind of bad practice to configure 3rd party lib in header file".

So at first you can take a look at this commit. IMO this is a better way to configure it.

Also you can add your fork as a Pod using:

pod 'MKStoreKit.MyFork', :path => 'MKStoreKit.MyFork.podspec'

EDIT: Thanks to rounak for noticing, :local is now :path. From cocoapods docs:

Using this option (:path) CocoaPods will assume the given folder to be the root of the Pod and will link the files directly from there in the Pods project. This means that your edits will persist between CocoaPods installations. The referenced folder can be a checkout of your favourite SCM or even a git submodule of the current repo.

like image 38
Dmitry Zhukov Avatar answered Sep 20 '22 12:09

Dmitry Zhukov