How to change a github repo's directory to somewhere else? - xcode

To avoid being a X-Y problem, this is what happened:
I removed all the pods from the Podfile a few days ago because I didn't need them anymore. Today, I opened up the xcworkspace and see errors. One of them is this:
diff: /../Podfile.lock: No such file or directory
So I first try to solve the issue myself. I tried pod install, pod update, and lots of other stuff. They all didn't work. So I thought, FINE! I'll delete all the cocoapod-related stuff and start from scratch again! And so I did. But the problem is still there.
Then I downloaded the whole project from github and deleted the broken one. I tried updating cocoapods to the newest version and pod install, everything is working in the downloaded project.
After that, I found out that github is not tracking the changes of the downloaded project. It is still tracking the changes of the project in the trash.
I need to find a way to change the project that github is currently tracking to the downloaded project. How do I do this?
P.S. I am an absolute noob of command line interfaces. I cannot remember all those git commands. So if someone can show the solution both using the github (Mac) app and the CLI, it would be greatly appreciated.

I solved this problem with this:
Create a temp folder
Move all the stuff in the downloaded project's project folder to the temp folder
Delete the downloaded project's project folder, which is now empty
Move the deleted project from trash to the original position i.e. "Put Back"
Delete the contents of the original project folder
Move the stuff in the temp folder into the original project folder, which is now empty
Profit!

You might have to add the newly downloaded copy to the SourceTree.
here are the steps -
SourceTree --> New Repository --> Add existing Local Repo --> Then in the finder window locate the newly downloaded repo.
Now I believe you can see the changes of the new project and commit as well. PFA screenshot.

Related

Commit to git after switching to workspace and adding CocoaPods library

I'm a Cocoapods newbie, so I have a basic question.
After adding cocoa pods to my project, a workspace file is generated, and from now on I must to use this file to open and work on the project.
Currently my project is stored in an Git.
To enable my working partners to work with me on the project, I need to commit the .workspace file so they to can open and work on the project too. But unfortunately, after creating the workspace by the cocoa pods, my Git client (Source tree) doesn't recognise the .workspace file as a added file.
Is there something I'm missing? Do have to commit my .workspace file in order to enable my code partners to work on the project with the Cocoapods added library? or maybe its a Xcode setup in order for the Git to recognise the new workspace?
any assistance would be greatly appreciated
Did you try?
git add --all
git commit
And then checking if the file was added???

Source Control - Discard all changes deleted my xcworkspace and I can't fix it

I was trying to undo changes on my project to the last committed Source Control state, however when I pressed 'Discard all changes' weird behaviour happened.
The first time some of the files reverted whilst others didn't. So I pressed the button again and a blurb popped up saying something about needed to re-save the 'xcworkspace'. I pressed okay and half my files disappeared from the xcode file list on the left, really random files that hadn't been edited at all. So I decided to press revert again to see if I could get back to my original state, and now all my files have disappeared from the xcworkspace. So my screen now looks like this:
I have tried restoring the files from my trash (as this is where random ones have appeared) but the workspace is never restored. I use MapBox so I have 2 projects building in to 1 workspace, but the podfile will now not install.
Can anyone give me advice on how to get this back to it's original state as I have been trying for a few hours but can't find any information.
I felt horrible when I did this. I really thought I had to rebuild everything over again. Luckily, it was easy to repair.
Xcode removed all the "non-essential" files. This includes your Podfile (and if applicable, GoogleService-Info.plist).
To Repair:
Go to Terminal and create a Podfile in your project folder $ pod init
Update your Podfile with the pods you need
Run $ pod install
(4.) To re-generate the GoogleService-Info.plist file, go to your console.firebase.google.com > Settings > Project Settings > Download the latest config file for the appropriate project iOS app and save to your local project folder. Your workspace should recognize the file in the Project Navigator list.
Once you open your workspace, select new Scheme and everything should be back to normal.
To avoid future regressions:
Go to Terminal
git add -A
to add the pod files, then
git commit -m "Save pod files"
to save pod files. I believe git from Xcode ignores the pod and scheme files.

Crashlytics file not found

Recently opened a project that I had compiled and submitted to Apple.
I haven't touched it for a couple of months but I'm getting this odd compile error at:
#import <Crashlytics/Crashlytics.h>
The error reads:
'Crashlytics/Crashlytics.h' file not found
Clearly the framework can't be found but I'm puzzled as to why, when the project was working a few months ago, it's suddenly stopped.
Any suggestions why?
Xcode: 4.6.3
Mac OS X: 10.8.4
Just add $(SRCROOT) to the Framework Search Paths in Project Build Settings (Search Paths).
Crashlytics installation process drops its Crashlytics.framework to your project folder (or creates the symlink).
If you moved Crashlytics.framework somewhere deeper in the project folder hierarchy - set 'recursive' to the right or just point directly to its parent folder in Header Search Paths:
$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework
Delete frameworks from you project and disk. Check that you have the newest version of Fabric plugin.
Copy frameworks from plugin folder to desktop with this commands:
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/com.twitter.crashlytics.ios-default.zip ~/Desktop/
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/io.fabric.sdk.ios-default.zip ~/Desktop/
Add frameworks from desktop to your project.
Info from: https://twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2
I'd recommend just using CocoaPods to add the Crashlytics framework. No need to care about paths anymore.
Podfile:
pod 'Crashlytics', '~> 3.4.1'
Script Build Phase for dSYM Upload:
./Pods/Crashlytics/iOS/Crashlytics.framework/run <your_crashlytics_id>
Import:
#import <Crashlytics/Crashlytics.h>
For me, this worked:
Remove the fabric and crashlytics frameworks from your project, and delete the files from the disk for our project.
Comment the lines in your appdelegate.m file, if you added them for the following:
import Fabric/Fabric.h
import Crashlytics/Crashlytics.h
and
[Fabric with:#[CrashlyticsKit]];
In the fabric app, choose "New app", and select your Xcode project file
Recopy the build script and build as instructed. The build step is why you needed to comment the lines above-- it won't work if you leave those lines in.
After the build script runs, it will prompt you to drag the frameworks from the app window into your project navigator. This will copy the latest versions of he frameworks (which include the .h files) into your project
I have tried manually downloading, and copying from other projects, but this is the only way I could recover after losing the frameworks files for an app.
In my case, the Framework was in the project folder, but not in the Project Navigator. I dragged it to the project and everything worked fine.
I've had this issue working with distributed teams (through github) after checking in then checking out Crashlytics. The Crashlytics.framework will only have one folder inside it -- "Versions". You need to save a version of the contents inside Crashlytics.framework to another location, then copy-paste them into Crashlytics.framework later.
Remove Crashlytics.framework from the project and disk. Copy and add it again. It helped me.
In my case, I was migrating from an old Crashlytics install through the Mac app to Cocoapods. A lot of the answers to this question recommend completely removing everything and starting over. I started doing this and noticed a discrepancy between code found in Fabric's documentation and the code shown in the Fabric app during the step where it tells you what to copy into your Run Script Build Phase.
Fabric's documentation has double quotes surrounding the entire string: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"
The Fabric App only had double quotes around the path to the run executable: "${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
So before you delete everything and start over, try updating your Run Script Build Phase to this:
"${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
I have changed the name of the working folder and Craslytics fails. Check this in Build Settings (Search Paths).
Good luck!
I have tried to play with the frameworks search path and relocating & reconnecting the framework file; checked the build settings (Link binary with libraries section) but the error persisted.
Finally, I have reinstalled the framework, which only takes 2-3 minutes. The problem might be caused by that you have relocated the Crashlytics.framework to another subfolder from the root directory, but I am not sure about the exact reason.
Delete everything regarding to the Crashlytics
Start crashlytics app, login and select your project
Add run script
Drag & drop the .framework file (I have kept it in the root folder)
Add the import and startWithAPIKey statements back
Completely Remove the Crashlytics Frameworks on your proj include the shell script in App Build Phases Run Script.
Reinstall the Fabric follow the guide,everything will be OK.
I had previously upgraded to Fabric and had no issues. A couple of days later, I reopened the same project and had the missing crashlytics.h file problem.
I couldn't simply reinstall from the plugin due to a non compiling project (I had so many CLS_LOG messages and references to the missing crashlytics.h file in my project, it would have taken a long time to remove them just to allow the build to work - refactor wouldn't work on CLS_LOG).
So instead, I deleted the crashlytics.framework from my project and did the following to reinstate it from the plug in directly:
Download the Fabric plugin again and double click the zip file to unpack the Fabric application.
Right click the Fabric icon and "Show Package Contents"
Copy the Crashlytics.framework folder to your Desktop and then re-add it to your project via File -> Add Files to ....
If step 3 doesn't work for you, you can also add crashlytics.framework to your project folder on your computer directly, and then also add it into your project list via Xcode same as in step 3 but uncheck "Copy Items if Needed" as you already put the files there yourself.
My project then compiled and worked fine again.
In terms of a guess as to why the file went missing? Part of the upgrade process got me to delete the old frameworks and then run the scripts etc. from the plugin. I think what happened is later when I emptied my trash, that some references were lost. I also had the problem where I'd put Crashlytics into my .gitignore file so it disappeared out of ALL my projects every committed which wasn't great.
Hope this helps someone!
I have same error.
Please try pod update
and fix it.
If FirebaseCrashlytics 9.0.0 installed , problem will be fixed.
stalling FirebaseCoreDiagnostics 9.0.0 (was 8.9.0)
Installing FirebaseCoreExtension (9.0.0)
Installing FirebaseCoreInternal (9.0.0)
//hrer
Installing FirebaseCrashlytics 9.0.0 (was 8.9.0)
Installing FirebaseFirestore 9.0.0 (was 8.9.1)
Installing FirebaseInstallations 9.0.0 (was 8.9.0)

Xcode 4 crash when opening project cloned or pulled from git repository

After pushing my project to remote and pulling it back to the other machine I get this crash when I try to open it in Xcode 4.3.2:
Project package contents:
This happens every time for this project.
I have tried to resolve it by cleaning proect package content form pbxuser and mode1v3 files but with no effect.
What could be the reason of that and how to repair it? Is there any xcodeproj repair tool or analyzer?
May it be fault of my gitattributes file?:
*.pbxproj -crlf -diff -merge
I do not use .gitignore on tis project (project is quite small).
I have had this in the past ... start Xcode on a known good project, close all windows, then go via File->Open to locate the .xcodeproj file, and select your new project. That solved it for me at the time, hope it will for you : had me stumped for a bit.

Annoying svn issue where svn claims folder is under version control but no .svn exists

I have a folder that both XCode and SmartSVN both claim is "already under version control." However, when I run svn status in that folder, it says it is not a working copy. Furthermore, I cannot add or subtract the folder from the working copy in SVN, for if I add it (with or without recursion) it claims it is already under version control, and yet there is no context option for me to remove it from said version control.
Furthermore, when I check to see if there is a .svn folder in that directory, there is not.
I have tried svn cleanup in the working directory root as well as the directory in question. When performed at the root it completes with no messages. When performed in the directory, it informs me that it is not a working copy.
It is causing an annoying Obstructing - warning in XCode that is bugging me.
If anyone knows what I am talking about or has experienced the same thing please help me out!
It happens when the parent folder gets out of sync with some of its children. A possible workaround is renaming the parent folder offline (using the file system, not via svn), get a fresh copy from the repository and then bring back your modifications from the renamed folder (excluding the.svn ones).
When finished delete the renamed folder. Otherwise you might end up with broken folders:
If you renaming a project, Xcode does not remove the .svn directory in
the .xcodeproj. As a result, svn gets confused, thinking the renamed
project directory is under version control
[source]
Make sure XCode and SmartSVN are expecting the right version of you SVN installation. After last upgrade of SVN, I noticed that things have changed in how SVN handles things. Everything is now stored in the root checkout folder, and you don't have .svn folder in ech sub folder anymore.

Resources