I have created my framework that i want to add in my project. What i do is:
In my project i chose Xcode -> File -> Add Files to..
In prompt window i go for framework directory, chose .xcodeproj file
Check "Copy items if needed" and "Added folders - Create groups" radio button
What i expect - .xcodeproj that contain my framework is added and copied to my project
What i got - i can see file in Xcode, but not in folder when my app exist. So, when i try to Delete -> Move to trash my framework, it delete it in folder when it was created (not my project folder).
I can't figure out how to actually add and copy file instead of reference to it.
Related
when you new a group we can not find a real folder in the project,So we new a folder and add it as files to the project.But this time in Xcode7 I AddFileTo my project ,the folder is blue .
You are adding the folder as reference. when you add the folder, make sure you check "Create groups"....not "Create folder reference". See the following Screenshot.
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
I'm using a Git. When I add a file and check "Copy items into destination group's folder (if needed)" this error occurs:
Try adding it to your project folder and then drag-and-drop to the project in Xcode.
If it still doesn't work you can just create a new file in the project itself, call it the same as the file you are trying to copy and then copy-paste all the code.
Hope it helps
Just delete the file reference from the XCode. Make sure not move file to trash. Then add the file again by drag and drop or by Add file to project option. Now the file will be under source control.
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.
When you add a folder that contain subfolders and files to the Xcode project, the Xcode ask you about the folder option:
Create groups for any added folders.
Create folder references for any added folders.
I want to download the folder from a server. When the download is complete, the folder option will be 1 or 2? How can I set the folder option to option 2?
When Xcode references a folder, it uses whatever files are stored at that location on your local disk. If you download a new file to that folder or copy a file into that folder, it will show up in your Xcode project. If you change a file in that folder (by overwriting it in the Finder, or by using another app to download another copy of the file over the existing one), Xcode will use the new one.