How to drag & drop file in xcode? - iphone

when i drag and drop any files than its show like below image.
so i want to know that what is "PrizeperdayTests"?
is i have to checked it when adding some files? what if i not cheked it? i ask this question because when i run my app from Xcode it will run but when i try to run my app using api file than its just close instantly.

This is a unit test target created by Xcode, probably as part of the project template you chose.
Unless you are dragging in files required by your unit tests, you can leave "PrizeperdayTests" unchecked.

Related

Xcode Base internationalization doesn't work

I'm trying to localize my app.
I noticed that if I add a language every localized file become doubled.
In this way it's impossible to maintain code or storyboard so I learnt that I need Base internationalization.
The problem is that when I select that checkbox in xcode project setting it shows a window without nothing to select, does anyone know how to fix this?
Here's a screenshot
First, you need to go to your storyboard file, open the bar on the right side, and go to Show the File Inspector, the furthest tab to the left. Then, scroll down and click localize. After this, when you check Use Base Localization, you should see the storyboard appear.
This could happen if Base Internationalization was active before then disabled and files deleted manually.
Create Base.lproj folder in your project folder using the finder.
Move your main story board to it also using the finder.
fix the reference to it from Xcode.
remove app. from device, clean & build your project.
All will be back to normal.

How to change location of iPhone app icon?

Okay, I am a noob. It must be simple but I stuck here.
I do rigth-click and choose 'select file'.
After I choose the file the dialogue appears:
I want to keep my icons not in the root directory. But I can't figure out how to do this. I tried different ways, even create project from scratch...
Please help.
When you bring image assets into Xcode they will all be in your application bundle's root directory at run time.
It appears that you've added a file named "icon#2x.png" to your project at one time already. Go to the project's summary page in Xcode click Build Phases and then expand the section titled Copy Bundle Resources. There you'll find the reference to the resources that will be copied to your bundle at run time.
More on bundle structures here:
https://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html
Anyway, the way I've done this in the past is to:
Remove the existing image duplicate from Xcode and from the folder structure in Finder.
Add a new folder in Finder call it "/AppIcons" (or whatever).
Copy all the app icons to that folder in Finder.
Drag the "/AppIcon" folder into your XCode project. I typically put images in an "/Images" subdirectory in the Xcode project. Again you can put it wherever you'd like.
In Xcode on the project summary panel, add your app icons from the folder "/AppIcons" by dragging / dropping or by right clicking and adding them as separate files.
Alternatively in the past when I've had problems with this sometimes Xcode will copy the app icons to the root project directory. If that happens, I make sure that I have the "/AppIcons" folder structure on disc (in Finder) and in my Xcode project. I add the app icons to the project, then move them to /AppIcons in Finder, and re-reference them all over again.
Your Copy Bundle Resources should then have the proper file reference. Note that my apps icons go in "/Images/AppIcons"
Good luck!
I would add the image files to your project with the name icon#2x.png. To do this right click where you want to add the files in xcode and click add file/s. Then search for your image and add them using the dialogue that pops up. - there is a check box so that you can either copy them to the projects destination folder which will copy them into you project folder or leave it unchecked (inadvisable) which would reference it's current location on your HDD. Make sure the file doesn't already exist in the project before doing this!
EDIT:
Sorry I forgot to mention then drag and drop the file from within xcode onto the image location box.
In XCode 4 (I'm using 4.6.2) you will get this confusing message if you've just moved the target's info.plist file, but not corrected the location at the top of the summary panel. Fix this and the icons will reappear, assuming they are added to the project, or if not you should now be able to drag them in without xcode insisting on making extra copies.
This tends to happen when you're starting a project and sorting out the mess of default file locations that xcode gives you. I like my project structure to be 99% the same as the file system structure.
This is an easy fix. If the image you want as your App Icon resides outside of the root of your project, when you get that dialog just click "Yes", and then click delete on the newly created file in the root, and "Move to Trash".
The reference is still there and works without a hitch, since the file will still be in the root at runtime

Drag and drop XCodeProj into another XCodeProj not giving me the option to copy

I'm trying to "install" core plot 0.4.
The first instruction is to drag and drop the XCodeProj file into my own project. I do this. Normally when I drag and drop images or the such like it asks me if I want to copy the file into my own project. However for some reason its not asking me, its just creating a reference.
I'm not sure what the difference is, and whether it will still work or not with a reference, its just the first instruction (http://recycled-parts.blogspot.com/2011/07/setting-up-coreplot-in-xcode-4.html) says to click the "copy into folder" checkbox.
However that whole dialogue doesn't come up. I drag and drop and it puts the xcodeproj into mine without anything happening!
confused lol
Thanks
Edit: My solution works, but the reason it works is in this answer: https://stackoverflow.com/a/5373575/264947
--
This is what I did to fix it:
Close Xcode.
Open Xcode and create a new workspace.
File > Add files to "Workspace".
Add the first project.
Build to make sure it builds correctly.
File > Add files to "Workspace".
Add the second project.
Build to make sure it builds correctly.
Drag one project into another.
Now, be careful with the next step:
Erase the second standalone project but choose **REMOVE REFERENCES. **
There. Now you should have one project as a dependent of another project.

Temporarily restrict certain resources from build inclusion in Xcode?

Is there a way to temporarily restrict which resources are included in the build of an iPhone app (via Xcode)?
I am testing a use case in my app and want to minimize the installation time on my device. I would like to do this by reducing the resources to only those needed by this use case... i.e. there are over 70MB of .wav and .png files that I do not need to copy over.
I am looking for something more elegant than moving the out of the project into a separate directory on the file system.
Thanks in advance!
Try this: duplicate your target in XCode (on the left-hand side of the XCode project window, open "Targets", click on your application target, then choose "duplicate" from the Edit menu).
In the duplicated target, go into the "Copy Bundle Resources" build phase and remove the files you don't want. Switch your "Active Target" (using the menu at the top of the project window) and build.

iPhone: rename resource on copy to bundle?

I have an iPhone project (Xcode, Objective C++) with two targets - A and B. I want these targets to have different launch screens. The launch screen has a hard-coded name Default.png. I made Default_A.png and Default_B.png.
At first, I tried to add both images to the project in separate folders (folders, not groups) under the same name, and resolve the ambiguity by including one or the other in the respective build. Xcode won't let me add the second file.
Then I tried to include a "Run Script" phase in each target that would copy the right image to Default.png. The phase is not invoked, it seems, since Xcode thinks the phase destination file is not out of date.
Question - is there a right solution to this conundrum? It's all ultimately handle-able, but I'd like to know what's the most seamless way.
The script should be run regardless of whether or not anything is out of date as it has no dependencies. Did you click the "Run script only when installing box" or something?