Best build dir location to use in Xcode - xcode

I'm consolidating my Xcode/TextMate setup and is interested in where you put your build dir.
Some years ago I started out having the build dir in the same dir as my xcodeproj file.
However it became a mess when my project became a multi project with a applications and frameworks and tests, so I started using ../build as the build dir, so that all the sub projects used the same dir. However Spotlight is indexing this build dir and TextMate's global find is unusable when there is a build dir in the project.
I'm thinking either using ~/.build or /build as Xcode's build dir.
What build dir do you use and why?

If you let Xcode create the build directory then it shouldn't get indexed by Spotlight (Xcode sets an extended attribute on the directory specifically to make this happen). If it's a build directory from an old project that been upgraded, or a build directory that you created manually, then this won't be the case and it will get indexed. You can either add this attribute manually if it's missing, or perhaps delete the build directory and let Xcode re-create it. Once you have this sorted out you should be good to go with your common build folder scheme.
The extended attribute is com.apple.XcodeGenerated.

Related

Out-of-source builds in temporary directory with Teamcity

I'm using Teamcity to build a CMake project. I'd like to leave Clean all files in the checkout directory before the build off, so that it doesn't have to keep re-fetching all the source for minor changes. Is there a way I can specify the CMake working directory to be in some temporary directory that Teamcity will create for me, and then delete when the build is done?
I thought %system.teamcity.build.tempDir% might do it but there doesn't seem to be any documentation for it, and I think that might just be the directory where all builds go.
%system.teamcity.build.tempDir% is fine. And so is %TEMP% actually (on Windows, or %env.TEMP% in TeamCity-speak): the agent overrides the env var and uses a clean temp directory for every run.

Why does Xcode use the old build path after moving a project's containing directory?

I have created a simple OSX Command Line App project with Xcode 6.3, called Foo, and set the location of Foo to ~/Desktop. Building and running the project is fine. To be clear, the project path is ~/Desktop/Foo/Foo.xcodeproj.
If I move the project's containing directory ~/Desktop/Foo to, say ~/Desktop/tmp/Foo, open ~/Desktop/tmp/Foo/Foo.xcodeproj, and then build the project, I see that Xcode creates ~/Desktop/Foo/build/ and so on. It seems that Xcode is still using the old build path rather than the build directory that is relative to the project (~/Desktop/tmp/Foo/build/).
Why is this? I am using a typical installation of Xcode and have not modified any configuration of Xcode nor the project or its build settings. Xcode 5 definitely did not behave this way.
Yes, the project has been cleaned.
I can only attribute this to accumulated cruft after installing, removing, and updating Xcode to various 6.x betas over the past year.
After deleting Xcode configuration via defaults delete com.apple.dt.Xcode, things are behaving as expected.

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)

Is it possible to sync only the source codes of xcode project with dropbox?

Is it possible to sync only the source codes of xcode project with dropbox?
I hope to synchronize only the sources rather than files in build directory under xcode project.
I sit possible?
Welcome any comment
The current versions of Xcode, by default, keep the build directory and other intermediate files in a separate directory under ~/Library/Developer/Xcode/DerivedData. Assuming you are using a recent Xcode and haven't configured it to save build files in your project directory you should be able to place your project directory in your Dropbox folder.

xcodebuild -list can not find scheme which existed

I have xcode project, I want to build this project under command line, this project composed many sub-project, first I fetch these source files to local disk, I use xcodebuild -list to find scheme, I can not find anything, while after I manually open this project with xcode and then use xcodebuild -list to find scheme, some scheme can be seen.
I compare the project file of these two scenario, for the second project, there existed xcuserdata folder, so I can find the scheme, the problem I need use scheme to build this project.
Any suggestion will be appreciated.
I've found that for -scheme builds to work correctly you need to have the project.xcworkspace/ directory in place within the .xcodeproj directory. The project.xcworkspace/ directory should have a contents.xcworkspacedata file within it.
In my case, the project.xcworkspace/ directory wasn't it the git repository because it wasn't previously necessary so I had *.xcworkspace in my .gitignore file.
check the file .xcodeproj/xcuserdata/.xcuserdatad/xcschemes exists,if not open *.xcodeproj and the file will be created by xcode,then get the current Schemes from xcodebuild -list

Resources