I'm trying to clean up my project in iOS XCode. I know you can do this in other tools but I'm unsure with Xcode. I have googled but I'm getting the impression this can't be done. Is there a way to search your project for unused items i.e. images and then remove them if not required?
Have you heard about Slender :
is one of tools that tells you which asset files aren't being used. Along the way, you can also see which assets are missing their #1x counterparts, or if your #2x images have incorrect pixel
Slender Link
Hope it helps.
There is also one question that helps you too How to find unused images in an XCode project?
Related
I have a little problem with xcode. I've already seen this question/problem but the answers couldn't help me this time (yes, I've had this problem in the past).
So my problem is, that xcode is not loading my images/external files while testing/running the app.
If I put my images in xcode without folder, so just the images, it loads. But when I put them in a folder (and some sub-folders) , xcode can't find the images anymore when I'm running the app (in the storyboard it can finds them).
I've already cleaned the app and re imported the images.
Also it isn't a problem with just 1 project, if I start an all new fresh project, I have the same problem.
I hope I've explained my problem enough, if there are questions, I'll be more than happy to answer those.
Also if you can help me out, I will be thankful forever! This problem is really slowing down the development of our app.
Have a nice day!
Try putting the images into the .xcassets folder where your AppIcon is. Also, add files individually into the .xcassets and not drag a whole folder of images into the project.
Sorry for the short answer but you could add more information to the question like images of your folder structure and how you call the image
I've read numerous other answers for this, but I thought it was worth posting the same question with an addendum..
I actually solved this exact same problem once before by adding the correct images in my images.xcassets window, however I don't recall how I figured out which boxes to put the image in? How do I link the errors to the correct box?
Are you using Cordova? I see you tagged it but have no mention of it?
If you are just to save you some time and effort theres a really good npm plugin that generates all this for you & my xcode picked up all the different sizes automatically. cordova-icon.
It's really simple, just have an icon.png in your root and run cordova-icon in your console. It generates icons for android iOS and windows.
What would be the best way to include a lot of images in the bundle? I have an index of (game) items thus about 4000-5000 image files (total 27mb so not that big). Just include the whole map in the bundle or maybe first write a script that converts them to NSData? I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one. Would love to hear your thoughts.
27mb isn't a huge amount to download so the easiest option would be to put them in an asset catalog, as Ryan Heitner mentioned in his comment this will allow App Thinning to take place in iOS 9.
I'm not sure what you mean by this:
I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one
Each image will need to have a unique name (this is true regardless of the number of assets you have) and your code references the images by that name so it won't have to "look through all images individually to find a single one".
Alternatively if you really want to reduce the initial download size you could use On Demand Resources (another upcoming iOS 9 feature) to store them on Apple servers and loaded on demand in your code. Presumably you won't be targeting only iOS 9 though so in this case you would need to host the resources yourself and load them using standard techniques (see here, here, here, or use a library.
You should pack them in a texture atlas.
Then, the texture atlas files should be imported in your bundled via a folder reference (blue folder icon) and not a group (yellow folder icon).
Images imported in bundle in folder reference won't be optimized be Xcode on packaging. So you can make your own file optimization using imageOptim. It can compress a lot more than what Xcode can do on JPEG and PNG images.
I am trying to copy over my Xcode project from one computer to another but it seems to lose frameworks and the locations for the images although i copied those too.
PS I am using xcode and coding an app with a friend. Is there a useful source that can help us both code at once/ transfer code files.
Thanks for the help.
Try transferring everything from plists to the storyboard. I did this with a friend of mine and it only took about 20 minutes for the code to build and run successfully on his own laptop. the biggest issue is going to be transferring the files that Xcode is going to have to search for, and making sure that the search paths match with where you save the new files.
SDK's and images are difficult because of this path issue - make sure you find where the pictures are supposed to be searched for then add the images there.
Just take your time - even write down where each file should go or where you have put it and you should get it working. Best of luck!
You have to select relative paths in your project for your resources/frameworks (e.g. Relative to group). If you have absolute paths, it won't work on a different computer. Also check in the Build Settings of your target the Framework, Library and Header search paths.
I ran into a strange problem today, after renaming a couple of images in my app and making sure they work on a device as well as the simulator, I used Build and Archive as I always do to build my app to distribute to the testers.
However, this time I got strange reports from the testers saying the images were gone, so I installed the build on my phone and to my surprise they were gone as they said. Tried to do a clean and build again but no change.
When I open the .app archive I can clearly see that many, but not all, of the images have turned blank, they appear to be the same physical size on the disk and they also seem to have the correct height and with when I press space to preview them, I can't however open them with photoshop for example (the file-format module cannot parse the file).
This is very confusing and as I have to get the build ready for testing very soon I would very much appreciate some help in this matter.
Your source PNGs seem to be slightly off-standard or at least incompatible with Apple's pngcrush. Make sure you use a commonly well functioning tool for creating the PNGs - when in doubt reconvert/resave them.