Xcode CUI Catalog bug - swift

I am building a game in Xcode 10.0, using SpriteKit, and currently I don't have an AppIcon in my game. Everything works great.
When I add an icon, some assets "go missing".
What happens is in the console I get the message:
"CUICatalog: Invalid Request: requesting subtype without specifying idiom for asset named: "img_xxxxx""
And then these images appear with the white box and red cross, just as if they were missing.
Not all images go missing. The ones that go missing specifically are ones inside a .spriteatlas folder I have.
I've tried deleting this folder and putting it back in, doesn't work.
When I remove the icon and build again, the images reappear.
I've searched this bug along the web and to most people it's just a log issue, and their images still show up, but to me it's really annoying because these images stop showing up.

To anyone in the future:
- Remove and re-add an 'AppIcon' in the Assets.xcassets folder.
For some reason this will reset something in xcode and have your assets load again.
Experienced the same issue and this fixed it.

Related

Get rid of file icon shadow when file is not saved in Xcode

When a file was just edited and not saved in the Xcode editor the icon of the file in the right pane is darkened a little, and because I have OCD this drives me absolutely crazy and I end up having to click Ctrl+S every time I do anything as simple as commenting a line of code or moving a button 1 pixel in storyboard.
I am using Xcode 10.1 Beta 2, but this happens in all versions of Xcode.
How do you make it so the file is never darkened?
I have the same problem in Xcode and I always command s everything as well. I have looked for a way to disable this, but for now I don’t think there is a way... Maybe they’ll add a way to turn this off in another update soon :)

Xcode 9 - TvOS - Launch images not working - Interface Bug?

Please help, my Launch screen images are not showing up. I have checked EVERYTHING and the only thing that looks out of place is in the interface the options for "Launch Image Source" is missing the "e" on source. I also think it should be showing "Launch Image File" but thats not there because I think it is failing to read this correctly out of some file and parse it.
My images are PNGs, with no Alpha layer, and the correct pixel sizes. I have tried cleaning and reloading, re-installing, etc. I have no warnings in Xcode.
I have tried to delete and recreate the Assets.xcassets folder, and delete and create the LaunchImage itself. I have tried removing the file extensions from the images as some suggested. The missing "e" in the interface seems to be the only thing out of place!

XCode buggily loading images that aren't in my project folder

For some reason, XCode is acting up really oddly. I have been testing XCode's ability to load images with the -hd suffix, and realized that Xcode will load a file "welcomeBackground.jpg" regardless of whether it is actually in my project folder.
See, this code below will not crash when compiled. And this is the first screen that is displayed when the app loads. I deleted the file "welcomeBackground.jpg" from my project folder, and XCode still loads the file as if it were there.
This is really freaking me out. Please help?
I am 200% sure I deleted the file from my project folder even and yet Xcode does not crash on line 35.
EDIT: To repeat, things I have tried/checked
- Cleaned project
- Deleted Derived Data
- Checked for hidden files in project folder
- Deleted app from iPhone and re-run from XCode
- Deleted the files from my project folder
- Loaded another image "sadhieia.png" and crashed Xcode
because Xcode couldn't find the file (as it does not
exist), and then tried "welcomeBackground.jpg" again
and Xcode somehow finds it.
And yet, the background still loads...
In Cocos2d, if the specified image is not in your folder, it'll not crash. Instead, it'll return nil to your CCSPrite *background.I suggest you Don't use Camelcase for images. Use lowercases or underscores. Try deleting Derived Data. See this for how to delete derived data.
Scroll the project navigator down to the bottom, to "Products," then click the disclosure arrow to show your application.
Right-click the application and choose "Show in Finder" from the contextual menu that appears. A Finder window is displayed containing your application.
Command-click the title of that window; another contextual menu appears. From that, choose the folder "Derived Data." The Finder then displays a window for that folder.
In this window, you'll see a folder whose name is that of your application, followed by a long string of letters. Trash it. If you see multiple folders bearing your application's name, trash them as well.
Rebuild your project. That should take care of the issue.
This might be a slash and burn approach, but it's solved a lot of quirky project-related issues I've experienced in Xcode after attempting to clean.
Clean your project; your image file is still cached in the build folder.

cocos2d error while loading sprite

I am having a quite strange problem in loading a sprite that was previously correctly loaded. I get this error depicted in the XCode console:
CCTexture2D. Can't create Texture. UIImage is nil
Couldn't add image:test.png in CCTextureCache
I can not see what is changed any advice?
Do you see test.png in the project navigator ? If yes, click on it, and make certain it is included in the target (show Utilities, at the top right, above the word 'view', the right button of that group of 3 buttons). Make certain that in the pane 'Target membership', your build target is selected. If not, well... you know what to do.
Also, as a 'personal rule', before trying anything when this sort of thing occurs, i tend to clean the target (including the project derived data), then a build and test again. Xcode can have its moments with respect to keeping track of files and stuff.
Make sure the file is named "test.png" and not "Test.png" because the iOS devices use a case-sensitive filesystem. The file also needs to be added to your Xcode project to the correct target.

Image files not being read on iPhone

This one has me confounded, so I'll try to go through the chronology so someone smart than I am can show me where I'm going wrong.
Everything was working perfectly on my app, both on the device and on the simulator. I have an image file, myimage.png, that is located in the directory where my project is and has been added to the project. It shows up in XCode and everything.
I build, run, and things work as planned.
Then I decided to get clever in photoshop and spruce up my image with a bit more color. In the finder, I deleted myimage.png from the directory where my project is located. Then I saved the new image as myimage.png in that very same directory. Back in XCode, the file shows up in the project and looks just as nice as planned.
I build, run, and no image shows up. WTF??!?
Here are my two questions, in order of importance:
How do I fix this so that my image shows up again?
What have a done wrong in this process?
Thanks!
EDIT: Here is the code where I am calling the image. In myViewController.m:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// SOME CODE THAT DOES OTHER THINGS UNRELATED TO imageView
[imageView setImage:[UIImage imageNamed:#"myimage.png"]];
// MORE CODE THAT DOES OTHER THINGS UNRELATED TO imageView
}
ANOTHER EDIT: Not one single character of my code changed between the app working and not working. I appreciate all of the suggestions since I clearly cannot figure this one out on my own, but the problem is most likely not with the code.
easy: in xCode delete the file reference and the files themselves and then import it again...
mhm... when you changed your image was xCode opened? it may have seen somehow it's been deleted and lost the link... if you change it xCode could "choose" to NOT include it in the target mainBundle when you build your project... in xCode select the file and see if the checkMark on target is selected:
if not it won't be included in you app (and this answers to your n:1 question too)...
maybe a better way to add a resource files which could be probably be modified by other programs in future while yourProject could be opened (i do it with an html site to be included, jpg and gif too) is to put them in a subFolder of your project and then add all that folder to your xCode project AND in the dialog window choose:
"create folder references..."
that will create a blue folder in xCode and all its contents will refresh automatically if you change, add, delete files or subfolder inside it...
BUT remember that the subFolders will exist in the same tree-order in your app mainBundle, so if you need to load a .png you need to specify where to find it.
PS
check also that the file name is exactly the same of the old file, including UpperCase chars
("a" != "A")
I think that happens because Xcode doesn't know that the file has changed. Always add/remove files in the project navigator.
It should work if you clean your project and build again.
You'll need to do a Build -> Clean. And the rebuild.