Issues importing xcode project from another computer - xcode

I have run into an incredibly frustrating issue. I wrote an iPhone app on one computer, and now I am trying to work on it on another computer. I zipped the project, and sent it to myself, but when I open it, it seems that none of the images came with it. When I was adding the images, I always checked the box to have the images get copied into my project. All the image files show up, but they are in red.
I tried fixing the path of one of the hundreds of images, and after doing that, the image appeared in the typical color scheme of xcode in my project. The problem was when I tried to run the code, xcode said it couldn't find the image I'd just imported.
Next, I deleted all the images, and tried importing them again. Once they were imported, they all turned red again.
Has anyone else run into this issue? Help!

In Finder go to where the actually code is, and see if it did in fact move the images into the project structure.
When the resources are red inside Xcode it means Xcode can not find them you can right click on them and see where it is expecting them to be located. You can also do this after you import images to make sure they are in the project structure.
Usually XCode folder structures have a "resources" folder off of the root of the source code, this is where you should put all images. I usually manually copy them in there, and then just import them into XCode from there.

Related

Assets.xcassets disappears in Xcode

I have a projects that had many many assets that took countless hours to design. One day I went onto my project and my whole assets.xcassets folder is empty. The title is colored red and when I click on it it is just an empty file, no information in it. There is also no file for it in the file view of my project. How do I get it back. It is not in the trash can. It was emptied recently and it may have permanently removed my file. I have not done anything with source control. I never knew what it was. Now I need my assets because most of them were not saved anywhere else. I have also tried using EaseUS Data Recovery to recover it but it did not find the file. What can I do to get it back?

XCode project missing files on other Mac

I have multiple Xcode Projects in my Dropbox so I can use them on my iMac and MacBook. But when I open the projects on another Mac most of the imported Images, Videos etc... are red (missing). the files are all in the Project Root Folder. What can I do?
This error is because when you added the files (images, documents, etc) you did not tick copy if needed option.
That means if you deag/drop items from your desktop to the project, Xcode will reference the documents from your desktop. When opening the project on another computer, the Xcode is not finding your documents in the desktop of the other computer, thus the error.
Solution:
1- Delete all the red marked items (take note of them)
2- move them again to the project and make sure to check copy items if needed checkbox.
3- re upload the project to wherever you need and it will run.
Happy coding!

Any explanation for wrong images showing up?

Some background. Until I redo this part of the app, for now, I've dragged a bunch of images into my project. They are called Landscapexx.jpg and Portraitxx.jpg, where xx is a number from 0 to the total number of pictures (minus one) for that orientation.
At some point, I replaced the images used in the project. But the original images are still showing up on my device (but not in Xcode). Using NSLog to confirm which image is being loaded, I then look up the image with the same name in Xcode. Sometimes it's the same image. Sometimes it's not.
At first I thought the problem was that when building the app again the data remained. That would be a reasonable explanation. However, when I deleted the app, acknowledging that the data would be deleted, that did not solve the problem. Could this be a cache issue? If so, how do I clear the relevant cache?
One last thing. The images that appear incorrectly on the iPad have the project name checked in the file inspector.
The way I'm loading the images, by the way is using NSString *newImageName = [NSString stringWithFormat:#"Landscape%d.jpg",n];, for example. So the file simply needs to be in my project space somewhere, I thought. If there are two copies, I have no idea where the second one would be. I don't see them in Xcode.
P.S. If I run the app in the simulator, I get the same images as on Xcode. This suggests the errant images are cached somewhere in my iPad. Since deleting the app didn't take care of the problem, is there something else I can try?
EDIT: I found something that may point to an issue. If I go to the Build Phases screen and open the Copy Bundle Resources item, all the images are listed there. However some of them don't have the ...in projectname after them. These same items have the project checked in the file inspector. Not all the images are this way. What do I need to do to ensure all the files are correctly in the project?
I suggest deleting the app from the phone, cleaning the project, and rebuilding the app. This happens to me on occasion and this usually fixes it.
I figured it out. Going through all the menu options in Xcode, I found an option called Clean in the Product menu. I selected it, rebuilt the app and all is fine now. This option apparently clears out the precompiled stuff that occurs the first time a project is built.

xCode 4 Adding Folders

In xCode 3 I could drag a folder into the project and say add references and it all works. When doing the same in xCode 4 it makes the folder blue and when trying to build it hangs at Attaching to .
I have tried everything but I couldn't resolve it. I have read :
Xcode building and resources folders
But that didnt help me. Does anyone have an idea?
Adding a folder by dragging still works in XCode4. Look at the following dialog, the first alternative for Folders will turn the folder yellow, creating a smart group.
The second alternative will turn it blue referencing the folder directly.
It is important not to call this directory ‘Resources’, as it seems to confuse Xcode into giving a lot of ‘Application is already installed’ errors.
Quoted from here: http://majicjungle.com/blog/123/
And worked for me on the same issue.

xcode copying project to another computer

I'm having problems copying a project over from one mac to another. The project compiles and runs fine after being copied, however xcode seems to have some duplicate of the same classes which seem to be invisible on the project browser on the left.
For example if I jump to definition on a variable I get 2 suggestions pop up. The top file when I look at its properties is relative to xcode folder (this is also the one that shows up in the class browser to the left). The second file which cant be seen on the browser has absolute path type in the properties.
Is there any way to get rid of this behaviour so its just looking at one file only like it originally was doing on the other mac? Its a bit problematic as I am never sure which one I am editing and they don't seem to update each other even though they appear to be the same file.
On a side note if I copy the copied project to another location then I get 3 etc files pop up in the jump to definition.
It's usually a good idea to either not copy the "build" folder (or delete it after you've copied everything over - only do this when Xcode is not running though).
Ok so what you need to do is this:
1.Duplicate your project.
2.Open the copy w/the original ,but only the folder.
3.open the Projects files(not the tests the main files)
4.then Drag and drop the files into the xcode area.
5.Zip the folder and its done
its like that because it just removes the references but not the files they are all still there though so just add the references back into the file.

Resources