-HD image file not found? - objective-c

Why am I getting
cocos2d: CCFileUtils: Warning HD file not found: META-hd.png
If I definitely have META-hd.png file in my project?
What I am doing is running my .tmx tilemap. The map uses a tileset that searches for "META.png" (without -hd suffix since I am expecting cocos2d to automatically put it on).

I've found the problem. I only do have -hd versions of my files. But I don't have "non-hd" versions. And for some reason, CCFileUtils will throw me errors when I don't have both types in my project.

Verify that the image is part of the app's target. If it was included as part of a group, and say there was a duplicate on file 10 of 25, the copy stops and files 1-9 are NOT tagged as part of the target. You have to go back and sweep the floor by hand.
In Xcode 4 show the assistant editor, and click the resource in the navigator. The target membership will be shown. If your app is not checked, click on that and voilĂ , the file will now be found.
In rare cases, i have had to clean the target and recompile to make this effective.

If I understand correctly you will have to have a -hd version of the tilemap as well: meta.tmx and meta-hd.tmx.
Also be sure that your image file is named META-hd.png and not META-HD.png and both images use the same case: META.png and META-hd.png. The iPhone file system is case sensitive (not the iOS Simulator though).

Related

Windows 10 Phone Store Logo Error

I created my app in Unity and after publishing for Android and iPhone, i'm trying to get the Windows 10 Phone version published.
I added my image assets to Unity, but when I open the generated project in Visual Studio, I get the following error in the Visual Assets tab:
A mixture of mages with and without the "scale" or "targetsize" qualifiers exists in the project for the logical name "Assets\StoreLogo.png" for the "Scale 100 50x50 px" image. All the other images are importing correctly.
The only related question I see on SO is:
Adding all images to the Package.AppXManifest results in a compiler warning
but in my case it is an error instead of a warning
The image with the correct scale does exist in my Assets folder, even though I had to add it manually:
Just wondering if anyone knows how to debug/fix this? rename the image, create a new image etc? ie: Why the 50x50px scale 100 image is not working as expected.
My Unity version is 5.3.4, Visual Studio 2015
It's basically saying that StoreLogo.png will be ignored since there is a file with same name plus the scale qualifier: StoreLogo.scale-100.png.
When packaging the two files are considered the same, but to prevent unexpected behavior you should delete one of them. It basically means that if you change StoreLogo.png, but not StoreLogo.scale-100.png, the output will not change since the packaging process will always ignore the StoreLogo.png file.
I would rename the StoreLogo.png file to just Logo.png and keep them both. But you can also delete one of them and get rid of the warning.
Seems that the order of adding the PNG to the project matters. So, for the StoreLogo you would need to add the 50x50 resolution PNG first.
And if you are using version control, make sure it is checked-in.

Icons, Asset Catalog and Info.plist confusion

I have an app that started life for iOS 5 and has been updated ever since. For iOS 7 I have switched over to using an Asset Catalog for all the resources, which is nice and appears to work well. However, when I try to submit to Apple I get validation errors:
Invalid Image Path - No image found at the path referenced under key 'CFBundleIconFiles': 'Icon#2x.png'
I get the same error for the other icons, too. These icons do appear in the Asset Catalog and the names -- right down to the case -- match exactly as far as I can tell. The Asset Catalog is in the "Copy Bundle Resources" and all the resources appear in the right place when I run the app on both my iPhone and iPad (in iOS 7) and in the Simulator for iOS 6.
I have updated the app to use the minimum deployment target of iOS 6.
So, how do I successfully submit my update to Apple? Do I need the references in the Info.plist? Are there any other settings that I should check? Is the warning spurious and something that I should ignore (after raising a Radar)?
When an asset catalog is compiled for iOS 6 and lower, the images are put in the root of the app bundle, as if you were just copying them the old way. When this happens, Apple names the images according to the asset name, rather than the filename, which means we can still use +[UIImage imageNamed:] to get the assets on iOS 6 and lower.
This is true for the App Icon asset, when we have the following icons set in our asset catalog:
They become compiled like so:
As iOS 6 is still iOS 6, these files must be referenced in the Info.plist, otherwise the existing system wouldn't work. Looking in the compiled Info.plist for this test app, you see that Xcode has added CFBundleIconFiles for us and so we don't need to.
I have uploaded the test project I used to github.com/danielctull-tests/AssetTest.
Okay, so here is what I ended up doing. I'm not 100% sure it's correct but I thought that it was worth sharing.
I removed CFBundleIconFile, which I don't think is used in iOS 6 and above
I used the asset name rather than the icon filename in CFBundleIconFiles
I'm not clear what the proper names are so, for the sake of clarity: by icon filename I mean the name visible in the Attribute Inspector of the Asset Catalog when the icon is selected; and by asset name I mean AppIcon, which refers to seven actual icons in my case.
This both passes Apple's validation step and appears to look okay. I don't currently have an iOS 6 device but it displays correctly in the Simulator.
I had also a lot of Problems on this matter - I was constantly getting the error with the missing CFBundleIconName and that my Icons where not found. So here is my story, maybe it will be of help for somebody. By the way, I am using Visual Studio with Xamarin.
Add an Asset Catalogue to your Project with AppIcons (the actual name of the asset is not important but just that it is for the application icons). Add all of the necessary icon sizes. For the 'App Store' icon I have added an icon without a # in the name as someone in the forums suggested, but I am not sure, if it is 100% necessary. For generating the different icon sizes there are a lot of Websites and tools that can do that for you and you just need to provide the 1024x1024 one. They will generate the rest.
In the Info.plist under 'Visual Assets' and then 'App Icons' set the source to the asset that you have just created.
Now check your Info.plist. Do not open it with an external Editor, because all of your changes will be overwritten once you build your project. Do the following - right mouse click on the Info.plist in the Solution Explorer then select Open With -> Generic PList Editor.
Check that you have the following entries:
-Property = CFBundleIconName, Type = String. Value = Assets.xcassets/AppIcons.appiconset
-Property = XSAppIconAssets, Type = String. Value = Assets.xcassets/AppIcons.appiconset
Note that Visual Studio automatically adds, when it adds something altogether, 'Resources/Assets.xcassets/AppIcons.appiconset' as the Value. But in my case the Asset Catalog was created outside of the Resources folder and therefore, my icons where not found. So, check where your assets folder was created.
CFBundleIconFiles was not needed, because Apple uses the Asset Catalog instead now.
I hope that I was of some help :)

XCode warning - duplicate CMakeLists.txt while trying to change project name

I tried to change the name of my xcode project, (which uses the cocos2d framework), but for some reason my main files folder (the one that contains all the .h and .mm files) wouldn't change the name. so then i manually clicked under "MyProj TARGETS -> Build Settings" and manually changed the fields:
Info.plist File
Header Search Paths
User Header Search Paths
Prefix Header
to be using "MyProj/" instead of "PrevName/" (the previous name i had named the project) but now i'm getting these two strange warnings:
Warning: Multiple build commands for output file /Users/me/Library/Developer/Xcode/DerivedData/MyProj-fzlkaghtvjzkgkenbpejhzwvxsft/Build/Products/Debug-iphonesimulator/MyProj.app/CMakeLists.txt
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'MyProj/Resources/Info.plist'.
you'll see that this is also mentioned under: http://www.cocos2d-iphone.org/forum/topic/33245 but no one has answered this part
and i tried to look under Xcode warning: "Multiple build commands for output file" to see under "Build Phases -> Copy Bundle Resource"... and indeed, there were 2 CMakeLists.txt files. one is:
MyProj/libs/Box2D
and the other is:
MyProj/libs/kazmath/src
which one do i need? or do i need both, since i think xcode used to be compiling with both??
i should mention that my project seems to be running okay right now if i leave the warnings in. but i don't like warnings that i don't understand, and i know that i could just swap my source/assets to a new project to get rid of the warning, but i'd like to know for future reference how to properly rename everything in a xcode project.
Thanks
Oh wow... I had no idea the traffic on stackoverflow is so low these days...(or at least for xcode & iOS dev) sighs
Anyways, I think I figured out a fix.
I read apple developer guilde for the second Warning
For the first Warning, I looked at another file that I had created, and I compared my project's settings to the other project's settings. (such a simple solution, duh, why didn't I think of this >_<) and it turns out, under Copy Bundle Resources, you're only supposed to have:
Your .png files and other resources used in code (but NOT your plist file, for the very reason given in the link above)
iTunesArtwork
ChangeLog
Actually, i'm not sure if you even need #2 or #3. I'll give an upvote to whoever experiments with it. So.... the solution is to simply remove all those other CMakeLists and cmakes and all that junk, including plist :)

Objective C two errors pngcrush

I don't have any problems with my code, but I think there are some settings wrong.
On the simulator, my application works great, but when I want to put it on my device I get the following error:
**pngcrush caught libpng error**
Could not find file: /Users/USER/Library/Developer/Xcode/DerivedData/PROJ-afhreiqghfsdvwbrdbfrawtkuser/Build/Products/Debug-iphoneos/PROJ.app/Email.png
This is the first error I get, and it only happens with Mail.png and Emailp.png. All other pics are okay.
The second error I get is not really an error. But when I view the .app folder which is on my device, I have lots of files which shouldn't be in there:
AppDelegate.d
Appdelegate.dia
AppDelegate.h
AppDelegate.o
Proj-Prefix.pch
I have these for every header. How can I change it so it won't all land in my bundle?
I'm gessing that Email.png has not been linked to your target when you imported the image, thus it has not been moved to your device.
You can check if you select the blue area with the project's name in the navigator window and go to Build Phases -> Copy Boundle Resources and add it with the little plus sign at the bottom if it's not in the list.
My other guess is that the actual filename is email.png and while the simulator is case-insensitive, the device is not. That can be why it cannot find it.
EDIT:
2, I'm quite certain XCode generates those files at build time and somehow they got put in the .app package. Can you tell us what's inside those files?

Custom fonts on iOS app - working in Simulator but not iPad

Encountering a weird problem here. I'm developing a game for my school project (non-commercial), and I'm using a custom font Black Chancery (free under GNU GPL). I followed the instructions from multiple sources, which includes:
Add the font to the project (TTF).
Modify app-Info.plist to add the font to it ("Fonts provided by application").
Using [UIFont fontWithName:#"BlackChancery" size:30] when the font is needed.
I could get the font displayed in the Simulator, however when I load it into my iPad, the default system font is used. I'm pretty sure there isn't a problem with the font itself as it displays in the simulator, and I've used FontForge to open the font without any warnings (following from This Question).
Any help is greatly appreciated. Thanks! :)
I can only guess as you haven't posted the contents of your plist or a directory listing of the bundle, but many cases of "resource works on the simulator but not on the device" are caused by the fact that the OS X filesystem is normally configured to be case-insensitive while the filesystem on the device is case sensitive. For example, if your file is named "BlackChancery.TTF" and your plist refers to it as "BlackChancery.ttf", it will be found on the simulator but not on the device.
I was having problem with font not recognizing, I fixed it by checking the correct name of the font by checking info of the font file by Get Info option. In my case the file name was written xyzfont.ttf but actually it was XyzFont.TTF in the info, i replaced and it worked.
Hope, it helps someone.
Another Way
I have come across one more way of finding the correct name, is by installing the font in the FontBook..
Just open FontBook from Finder and select User now from File->Add Fonts select the font you want to add into your application, after little processing the FontBook will show the Font listed in with the Correct name, use the name in the FontBook ignoring the actual ttf file name you have imported or, added to plist.. It should work..
I had the same problem which was resolved with a slight variation on iphonc's solution. The case sensitivity was directly related to the file extension. The problem was associated with my font file named: Choc.TTF
I had to remove the reference to the file in xCode 4.1
Rename the file to Choc.ttf (note lower case file extension)
Add the reference back into xCode
Perform a clean and re-build for the device
Conclusion (in my particular case):
Case sensitivity applies not JUST to the file name, but to the file extension as well (i.e. iOS device appears to tolerate only lower case).
My answer is different from all the rest. I had a problem because the font was all one word and lowercase "compassnormal.ttf" and the name in the file was Compass. So, my code was:
[UIFont fontWithName:#"Compass" size:24]]
Bundle Resource said:
compassnormal.ttf
~info.plist said:
compassnormal.ttf
None of this worked until I changed the actual filename to match it's official name in fontbook.
deleted all references from Bundle Resources and ~info.plist;
added font with updated name to Bundle Resources;
updated plist with new name;
tested in simulator and on device, Voila!
I have also experienced a problem with fonts containing the dash (-) character. Remove that character from your font names and try with that.
So your font named Gotham-Black.ttf should be named GothamBlack.ttf
Also check that your fonts are not zero bytes. I had this same issue and it turned out that my font files had emptied themselves at some stage. Probably when rearranging them in XCode and AppCode.
You have to use the real font name in the [UIFont fontWithName:#"... method! Not the ttf filename!!!
This real name is mostly far away from the filename. Just open the rtf in the Mac font utility. In the header you see the font family!!! Only the family!!! if you now use
NSArray *fontNames = [UIFont fontNamesForFamilyName:#"MyFontNameFamily"];
NSLog(#"%#", fontNames);
in your code, you get the real real real name in the console ;-)
But in the plist entry you still need the (case sensitive) filename!!!
I have the same issue on Xcode 6. My file name was My Font.ttf, it doesn't work. I manage to make it works when I rename it to My Font.TTF, just change the file extension to uppercase.