Where are the app's build folders located? - xcode

Where are the app's build folders located? I cannot see anything in the app directory.

Build folder is located in Derived Data folder. You can open this folder through Organizer on Project tab.

In Xcode, on the left hand side where it lists your files, right click on your app (e.g. 'MyApplication.app' and click on 'Show in Finder'.
Hope this helps.

After you create the build in XCode, press Command+7 to view the Log. The log will display the exact path where the final .app file will be located.
Something like the string below;
Touch /Users/macmini15/Library/Developer/Xcode/DerivedData/test-ciynarecplxqjqdpmuonamtecgvn/Build/Products/Debug-iphoneos/test.app
cd /Users/macmini15/Desktop/test
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/touch -c /Users/macmini15/Library/Developer/Xcode/DerivedData/test-ciynarecplxqjqdpmuonamtecgvn/Build/Products/Debug-iphoneos/test.app

Related

How to configure Xcode to place build products inside project folder?

In Xcode (6.3), you can change the default build location in Preferences ▸ Locations ▸ Derived Data ▸ Advanced.
I've now set it to "Custom" and "Relative to Workspace" so it would always be located relatively to the location of the project folder, and specified the build folder as Build.
However, the Build folder appears in the same directory as the .xcodeproj folder. How can I make it go inside it instead?

How can I include a txt file in an Xcode project?

I added a file "IntegerArray.txt" as follows, first I went to File -> Add file to "project name", I selected my file and it was copied into the root folder of my project, the same one that contains the .xcodeproj file. Then I clicked on my project's .xcodeproj file in Xcode, after which I went to Build Phases -> Copy Files -> "IntegerArray.txt", however when I build my project, the following code doesn't work
let bundle = NSBundle.mainBundle()
let path = bundle.pathForResource("IntegerArray", ofType: "txt")
println(path)
I expect to see the path to the file as output, but instead I see nil.
So I want to copy a file to my project in such a way that the above code works. How can I do this?
If I have a normal Cocoa Application, then when I add files they are automatically copied to the built program's bundle. However, with Command Line Tool's this doesn't seem to be the case, I'm starting to suspect a bug with Xcode.
If you don't have a Resources directory in your project, select your project:
Then from the File Menu select Add Files:
In the window that opens click on the "New Folder" button in the lower left hand corner of the window.
A small pop-up window will open; type Resources in that window for the folder name then click the "Create" button. You should now have a Resources folder in your project.
Then the way I do it is to use Finder to copy the file into the Resources Directory of my project.
After the file is in the Resources Directory (in Finder), back in Xcode select the Resources directory in your project:
and use the File-> Add Files menu selection again. You should see your file highlighted (affineOutput.txt in this case):
Double Click on it and it will become part of the bundle.
As Milliways says, then check the Build Phases in your project to be sure the file is in the Copy Bundle Resources. If it's somewhere else, just drag it into the Copy Bundle Resources.
If you include in the Resources Folder it should be included.
You may need to select the Project and Target.
In Build Phases check is there is entry under Copy Bundle Resources

Finding hidden images in xcode?

I am trying to change image name , and i get :
The file could not be renamed because a file with that name already exists
I CANT find that image in there,(project assets) it was deleted.
How can i be sure that its not in there ?
Thanks.
Xcode shows what's in the project, not what's in the project's folder.
Open the folder of the file you want to rename (right click on the file in Xcode -> Show in Finder), and you'll probably see another file with the name you were trying to rename to. Remove that other file (if you're sure you don't need it).
What I would do move forward is get out of the IDE:
Remove the file from Xcode, but not the filesystem, by "Deleting" the file and selecting "Delete Reference Only"
Rename the file in the filesystem(finder or terminal)
Re-add it to the project file.
Caveat: Confirm you aren't renaming the file with the same name, but with only a case change, that gets a little weird, mostly with SCM tools, but also OSX filesystems are case-insensitve by default, so File.m and file.m are the same file.

How to get Xcode to refresh folder references on device?

I created a folder reference by doing the following:
Created a folder on disk. Added whatever files are meant to be in it.
In Xcode
---> Add files to project
---> Clicked on folder
---> Unchecked copy files if necessary
--->Clicked create folder references for any added folders
The problem:
Whenever I make changes to files in the folder (add/delete) etc. The changes are picked up in Xcode. (You can see the changes in project navigator). These changes are not there when I run on the simulator. Deleting the application on the simulator does not help. Only when I click "Reset content and Settings" in the simulator, does it pick up the changes.
I already have added the following script to my build phases:
touch -cm "${BACKGROUND_TEXTURES}"
It is run after compiling, but before copying bundle resources. My bundle resources contain this folder.
I'm not sure whether the script matters, since Xcode picks up the changes with to without it. It's the simulator that doesn't get updated, unless I manually set "Reset content and settings".
What is the correct way to solve my problem?
EDIT: I have tried Clean, then Build, but that doesn't seem to make any difference.
Example:
I create "Images" folder at project folder, and I "create folder references for any added folders".
Next I add touch -cm ${SRCROOT}/../../Images to Run Script,And I drag "Run Script" before to "Compile Sources"
clean and build,it's ok.

Visual Studio Test Project - Does not copy folder on deployment

Here is the problem:
1. Create a TestProject in your Visual Studio solution.
2. Open the .testrunconfig file and under the 'deployment' menu item, select the 'Enable Deployment' checkbox.
3. Now click on 'Add Directory...' button and add a folder which has some files in it.
4. Run the test project (use a dummy test).
Ok, now go check the TestResults folder: You will see that all the files got directly copied (to the top level)- the folder itself is not copied (with the files under them). This messes up my paths during testing. Can anybody tell how to get the folder copied instead of just the files underneath ?
Thanks.
Use the [DeploymentItem] attribute on the test classes that use it. You can specify a directory:
[TestClass]
[DeploymentItem("blahblah\\myDirectory", "myDirectory")]
public class MyTest
{
}
Note:
DeploymentItem is very slow when starting the tests. It seems to copy 2 files per second.
You can specify the attribute on a test base class. But it does not always work if you have more than one test project.
You can probably specify it on a TestClass that has a method marked with [AssemblyInitialize]. Then you have only to provide it once. Not sure, you have to try.
The source directory is relative to the solution location. This is hardly documented.
Open the .testsettings file in notepad. Now, you should see that for every folder to copy
<DeploymentItem filename="FolderName\" />
Change this to
<DeploymentItem filename="FolderName\" outputDirectory="FolderName\" />
The other option you have is to create another folder beneath the original folder, and then that folder will be deployed to the out directory. For example you can have this structure:
TestFolder/
TestFolder/TestDeployment/
And then in the testrunconfig you still select the TestFolder folder and the TestDeployment folder will be deployed to the out directory.
I just had this problem too today. I solved it by adding a folder called "deployment_files" in the project that contained the required folder. Then I put the required folder into the "deployment_files" folder. THEN, I opened the LocalTestRun.testrunconfig file under the "Solution Items" folder in the Solution Explorer. Went to the "Deployment" panel in the testrunconfig property window. Added the "deployment_files" directory to the deployment and voila. The folder within that was copied to the test results Out folder.

Resources