UITabBarItem Image disappearing when selected Xcode 6 Beta

deltajuliet picture deltajuliet · Aug 12, 2014 · Viewed 8.1k times · Source

Fairly new to development however the Xcode Betas are giving me a bit of a headache (Xcode 6 beta 5 / iOS 8).

Have found some answers but mostly relating to Xcode 5 and under.

Everything runs fine, however the selected icon/view controller disappears. In Xcode 5-4 the image assets weren't even coming through giving the following error message. Now they do, however the error message still runs.

Screenshot:

enter image description here

CUICatalog: Invalid asset name supplied: (null) 2014-08-12 15:16:26.521 TheApp[5275:3231837] CUICatalog: Invalid asset name supplied: (null) 2014-08-12 15:16:26.521 TheApp[5275:3231837] Could not load the "(null)" image referenced from a nib in the bundle with identifier "YourCompnay.TheApp"

I'm racking my brain trying to figure out if it's my connections / images or just an Xcode beta bug.

Def need help and a clear explanation. ELI5.

Any help would be appreciated. I can't seem to find anything specifically relating to this error.

Answer

Yjo-jo picture Yjo-jo · Aug 13, 2014

I am in almost the exact same spot as you. Like you, my "unselected" tab images would show up fine, but for my selected tab images, they would not be present, and I'd get the "could not load null image..." error.

I had been assigning the images within the Storyboard IB... perhaps this is what you were doing too. Either way, within IB in the Attributes Inspector for the UITabBarItem, there are two different fields. One is under the Tab Bar Item section and it is named Selected Image. The other is under the Bar Item section and it is named Image. Just to be clear (restating my first paragraph but in terms of IB), I had "valid" images that I had saved within my .xcassets assigned to each of these Image/Selected_Image fields (each image was slightly different from the other to distinguish selection). The one that I had in my Image field would show up, and the one that I had in my Selected Image field would not.

If I put the "good" one from the Image field into the Selected Image field, I would still get the error, which didn't make sense to me.

HOWEVER, if I only put my "unselected" image into the Bar Item -> Image field and left the Tab Bar Item -> Selected Image empty, THEN the one image would get used in both places AND it would be highlighted blue when selected. This didn't give me the minor image change that I wanted (as my review of the Apple Docs for Bar Button Item indicated I should have "thicker lines" in my image for the selected item), it does at least give me an image for the selected tab. Hopefully this will help you as well.