Github Missing Files After a Pod Update (Xcode) - ios

I am using GitHub to share my project with others. It was setup and working great. Then I just did a pod update and pushed with the update. Now when the project is pulled from the git it seems to be missing pod related files.
In other words, the program builds fine on computer that pushed the update. However when it's cloned error message like pop up:
error: <directory location>/Pods/Target Support
Files/BoringSSL-GRPC/BoringSSL-GRPC.xcconfig: unable to open file (in
target "BoringSSL-GRPC" in project "Pods") (in target
'BoringSSL-GRPC')
I tried doing a commit and pushing from terminal but the problem persists. Then I tried creating a new git but when I push to it all the old commits are still there and the problem persists. It feels like a fresh clean commit starting from nothing might fix the issue, but I haven't been able to figure out how to do something like that.

Check your commit changes after pod updated.
Follow these steps:
1/ Pod update and push this commit to GitHub
2/ Go to GitHub, click "commits" tab > click the commit that did pod update > see if pods changes is on the file changes record
3/ If you don't see pods changes, that means you do not push these changes successfully.
4/ Check .gitignore file, make sure it doesn't contain syntax like: pods/*

For anyone who stumbles on this later, I wasn't able to figure out how to fix the missing file issue so I simply rolled back the project to a git before the pod update.

Related

Xcode delete pod files folder and schema after discard all changes

when I use Xcode 9 source control everything was good.
When I updated Xcode up to 10 and when I press discard all changes - Xcode has deleted pod files, run schemas, and one folder where I store .xliff files.
When I pressed to 'Discard all changes' I see this alert
I know that I can reinstall Pods and made new schema, but I don't won't do it every time.
Please give me advise to fix this problem.
Please give me my source control back)))
I had a similar issue and I solve it with this way.
In Terminal
cd "your project dir"
git add

Xcode 9 - linker command failed with exit code 1

While compiling the application getting as following error
" compiled with older version of Swift language (3.0) than previous files (4.0) file "
Could you please help me?
Use the xcworkspace to build instead of the xcproject?
This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.
Delete the derived data and do a clean build.
And if you are building a framework, make sure you've selected Generic IOS Device while building or set the Build for Active Architecture only as true in Build Settings.
I think this happens because you changed your app name or maybe the target
look to solve this problem see your target in Podfile
and then come back to your xcode in the targets
select your target app and in linked Frameworks and Libraries (the last one down) see if there's
any pods with light color and a strange name than your target in the podfile
and remove it using the minus button down .
I'd rather fix the specific problem, but if none of the other answers worked a full reset can solve it. If you are getting this error and you are also getting error readouts that refer to "duplicate symbol files", AND all other efforts have failed, then a full reset could work for you.
What worked for me:
Read the error report to identify the repo that supposedly contains duplicate files.
Drag repo to the trash.
re-clone your repo.
set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.
After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.
I had the two copies of files in the codebase. Deleting one copy helped code to build successfully
I am probably late for you, but for future devs in problems...
If you have been manipulating the podfile or creating new targets or maybe changing the name of any of them, check that in build phases options your just have correct pod framework for the name of the targets.
if you have pod
first clean project and close Xcode then open terminal and go to folder of Project then pod update
open the project and run
in my case work!
I fixed this problem today by running the app in the simulator using the target associated with the bundle file named in the Build Settings-->Bundle Loader setting of the test target. Previously I had deleted my derived data folder while working on a different target that has a different Product Name than the one associated with the test target bundle file. Rerunning the app in the simulator must have recreated the bundle file in the derived data folder that the test target is looking for and then my tests started running fine.

Cocoapods missing project.pbxproj after Git clone

Im using cocoapods-0.36.0.beta.1 for a Swift IOS 8 project.
I keep code on a Git repo.
I got in a mess updating some libraries and decided to just clone down my project again.
I did the usual pod install after the clone. No complaints. Looked normal.
When i go to open the workspace I get
If i open the project i get
Has anyone any ideas on this as i'd love to get my project back? thanks
If you have the original project you can show the .xcodeproj's packet content and copy the .pbxproj file. Than, paste it inside the cloned .xcodeproj's packet content.

How to nuke a Cocoapods installation and start over with Github master

I am presently taking a course in iOS development and we use Github to submit work to instructors. Last night, I did an assignment on a project I've been working on for several days, committed the repo and stopped for the day.
This morning, I began another lesson that involved installing Cocoapods. I created a branch off of last night's branch (not the master) and installed a Cocoapod on it (Xcode was closed while I installed a Cocoapod). When I realized I was working off the wrong branch, I switched to the master branch and typed
git branch -d install-cocoapods to remove the local branch
I then checked out the master, opened it in Xcode thinking I'd see my master file, but I see remnants of Cocoapods. I checked Github and I see the last update was last night, but I can't get rid of the local references to the Cocoapods I attempted to install in on the wrong branch from this morning.
I checked Github and the project I saved last night is there, but I've been unsuccessful nuking local references to my project. How would I get rid of them and start with a clean "master" file from Github?
Remove all Pod files with this command:
rm -rf Podfile.lock Pods/
Stash all changes and then move to master:
git stash -a
git checkout master
Now write new Podfile and run:
pod install
I normally use git clean -fxd.
This single command will remove all untracked and ignored files and directories, and, most of the time, take your repo back to it's "cleanest" state.
But beware that this command will potentially remove any files that haven't been tracked. So please make sure that you have all the files you want to keep tracked.

Changing an imported library using cocoapods

I am working on a project using cocoapods and suddenly I see myself doing some changes in one of the libraries. How can I ensure that those changes will never be override by a pod update? Is there any way to introduce changes in a pod without updating the github project?
UPDATE : Forking a project
I have tried to fork the project and create a new specfile to point to the new project. I was able to install the basic stuff, however, for some reason, there are some dependencies that are installed but can't be referenced inside the pods project. Currently I have this in my podsfile:
'WhirlyGlobe', :podspec => 'https://raw.github.com/tiagoalmeida/WhirlyGlobe/master/WhirlyGlobe.podspec'
The fork of the library is in https://github.com/tiagoalmeida/WhirlyGlobe
UPDATE2: Missing Headers
I have found that the headers (Pods/Headers) for boost and Eigen (used from the WhrilyGlobe) are not being generated.
UPDATE3: Trying to do Something about the headers
I have tried to look in some of the configurations that are in this thread and I have tried the solutions in the FAQ but I believe that my problem is different. The headers are actually missing.
UPDATE4: Attacking the cocoapods version
I have uninstalled cocoapods and installed the version 0.20.2 (that was working before trying to use my fork) and it keeps all the same :/.
#pgb and wattson provided me good information but ultimately the problem was in a combination of things.
I don't know why but it seems that cocoapods 0.22 handles headers differently. I uninstalled cocoapods and installed the version 0.20.2.
To check the version of cocoapods I have used gem query and I have removed the cocoapods with gem uninstall cocoapods and installed the cocoapods with gem install cocoapods --version 0.20.2.
I have used my podfile like this:
'WhirlyGlobe', :podspec => 'https://raw.github.com/tiagoalmeida/WhirlyGlobe/master/WhirlyGlobe.podspec'
Where podspec points to my new podspec. I made like this because I need to remove the :tag from the original podfile (otherwise it always points to the same spot) and this way I have more control over the file.
In the podspec I have changed the source:
s.source = { :git => "https://github.com/tiagoalmeida/WhirlyGlobe.git"}
To point into my fork and removed the tag.
Thanks #pgb and #wattson for the attempts to help me. Upvoted both because they were both usefull.
You can fork a repository and then add your forked repo as a pod, so say you've forked the repo to https://github.com/tiago/ThePodProject.git, then set the pod to:
pod 'ThePodProject', :git => 'https://github.com/tiago/ThePodProject.git'
see here for more detail (under "From a podspec in the root of a library repo")
You are close to having it working with your forked repository.
I just tried it with the following Podfile:
pod 'WhirlyGlobe', :git => 'https://github.com/tiagoalmeida/WhirlyGlobe'
It downloaded WhirlyGlobe and then failed because hg was missing. I simply installed it using Homebrew: brew install mercurial and then runnning pod install was able to install all the dependencies.
The project compiles, but I'm not sure it works, go ahead and try it.
Be aware that it took a really long time to download and compile all the dependencies (shapelib in particular).
Just want to add my few cent to the answer.
I encounter the same problem. As someone suggested above too I went to subclass-ing the pod lib.
I was using ACEDrawingView and it has property image which is readonly.
I subclass-ed it and made this property read/write.
I personal feel going by sub-class is more elegant and hassle free solution to this kind of problem.
Unless there is huge development you want to do on side of your main project.
Saving custom changes using only Git (no forking)
For those looking for a simple solution, I have successfully solved this problem by using git stashes.
As mentioned, pod update will overwrite any changes you made. However, if you're using git what I like to do is commit all my changes except for my pod changes.
Once the only changes I have on my branch are the Pods changes, I stash those changes by running git stash save "Custom Cocoapod changes, apply after every pod update". You can give it any message you'd like by changing the text between the "".
This command has the side effect of reseting your working directory to the previous HEAD, so if you want to reapply those stashes you can just run git stash apply to get those changes back in, and then you can commit them to save them.
Don't use git stash pop as this will delete the stash after applying it.
Now, at some undetermined time in the future, when you update your pods and its time to apply the stash again, what you're going to want to do is run git stash list. this will return a list of all the stashes you've made with the most recent being zero indexed. You'll probably see something like this:
stash#{0}: On featureFooBar: foo bar
stash#{1}: On Master: Custom Cocoapod changes, apply after every pod update
...
If the custom cocoa pods changes stash is in stash#{0} then perfect, you can just run a git stash apply again and you'll get those changes on your working directory. Otherwise once you find which stash number your pods changes are you can apply that stash by running git stash apply stash#{1}
Applying stashes is easiest when you have a clean working directory on the same branch but thats not required. This page gives a good description of git stash and how to use it otherwise.
This is not the most full proof solution since I can foresee some issues when you have multiple people on the same project, but it's a simple way to solve this without resorting to more involved solutions.
There is an another way exist where you can fork the repository , modify the changes and maintain the library through cocoapods for future bug fixes and feature enhancement .....
I have recently published tutorial for the same here https://medium.com/#mihirpmehta/how-to-modify-cocoapods-library-within-pods-647d2bf7e1cb

Resources