cannot add certain images [duplicate] - ios

This question already has answers here:
Cannot add any images
(2 answers)
Closed 9 years ago.
Every time i add an image for i get the error below. For some reason even if i rename it it still doesn't work, this problem was happening before on another project so i deleted it and started again. i have already checked for duplicate images that did get rid of the error however once i built the project the the picture was blank and i get a message saying
2013-11-07 16:45:28.613 Chiswick W4[1812:60b] Could not load the "1frivoli.png" image referenced from a nib in the bundle with identifier "Studentathome.Chiswick-W4"
need some help urgently!!
Also i would like to add i can take a screen shot of that image and input it however i will have to do this is a worst case scenario i just want to know why my images don't work.
thank you

Often you can try to open the file with Preview, and if it opens resave it as a different file, and use the saved file in your project. It handles more png variations than iOS but usually writes files that can be read. Photoshop is just one of many sources that can create pngs unreadable by ios.

Related

Uploading App Images: "Invalid GeoJSON: Your routing app coverage file is invalid."

This question is not a duplicate to another question that asks about the same message, but in another context. The context of this question is just about uploading screenshot images and getting the message.
Today, I had a new message when uploading images to App Store Connect:
Invalid GeoJSON: Your routing app coverage file is invalid.
This makes absolutely no sense since, at this time, I had not even chosen a build for the upload.
Retrying to upload the images, it worked. But unfortunately, the message appeared for each language and format.
Is this a bug by Apple or am I missing something? I would guess that uploading images has nothing to do with GeoJSON.
I used Safari. Others seem to have the problem with Chrome. So it occasionally seems to happen on all browsers.
I had this same problem today while uploading App Store Icon on Preparing for submission page. Solved it by removing "-" from my image name.
This is an unusual bug. Apple might be already working on it. It's not coming on any specific browser. It occurs mostly when we are trying to upload more than one images at once.
Apple always keeps their live site maintenance work active, so this is most likely a bug occurring in their live site maintenance. It will be fixed soon.
For now, if you are finding difficulties handling screenshot uploads, you can try to upload them one by one rather than uploading in a bulk.
Important Note:
I am stating this on basis of the last few uploads I have experienced. Also, the solution I have given is tried from my side and it worked for me well. So, you can just try it out and I'm sure that it's not a browser issue. It can occur on any browser.
It did not work for me even if I provided English file names. It kept giving the above error.
Only thing that worked for me was to remove all underscores. So instead of iphone_xs_max_1.png, it worked when I renamed it to iphone1.png and uploaded.
Make sure screenshot files name in English.
Make sure screenshot files all the directory path(and folder name) in English.
it worked for me.
I had the same bug today. Some of the images uploaded without problems, others didn't.
I was uploading in Chrome when I got the issue. Opening the site in Safari and uploading the images there, solved the problem.
What solved this for me was removing strings of numbers and periods from the filenames. It appears the system is running the filenames through some kind of geocoder, and if there are strings of characters that could be interpreted as locations, it will error out.
Make sure after editing the image you save the file with an extension like myimage.png or myimage.jpg
In my case, I forgot to save the file with extension after removing alpha and transparency properties and no need to change browser etc.

Why does app crash on Cocos2d after sprite name is changed?

I'm taking over an app for a friend who had a developer stop working for him. We want to change the icons of the characters in cocos2d. It's a small running game like temple run. We had a graphic designer create another image with the same size and same file name.
We then simply drag and dropped the image to replace the old ones. At first it was running fine, then when we switched a few more, the game crashed.
just posting as an answer so it may help others too.
What it may be :
hitting the logs would let you know that "failed to load data from xyz.png" which means the file you are referring is not present in the project which in your case may be due to excessive refactoring.
Also, check the extensions ".png" vs ".PNG".

Saving xml file on iOS (pugiXml and Cocos2d-x)

Recently I've ran into a big problem with pugiXml (used within cocos2d-x engine).
Shortly, I've made a quiz game (in mentioned Cocos2d-x). I keep my questions (and some other data) in an Xml file. On new game they get parsed and inserted into dictionaries. If a question is answered, a short string indicating the answer (whether it was good or not - Y/N) is inserted into that Xml file (below that particular question). Later, I use this data to show statistics (I count the percentage of questions with good answers - which is counting the amount of Y's divided by the amount of questions, multiplied by 100).
I use:
CCFileUtils::sharedFileUtils()->fullPathForFilename(o_QA);
to get the file and later
pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullPath.c_str(), "rb", &bufferSize);
to put file into buffer and
pugi::xml_parse_result result = doc.load_buffer(pBuffer,bufferSize);
to parse data and start working on it.
Finally, I save the file with:
doc.save_file(fullPath.c_str());
Android:
It's working very well, although I had to copy the file with questions to /data/data/app/Files/ . Still, It's keeping the changes on many devices.
iOS:
Unfortunately, on iOS it's not working. Data get loaded and parsed (which means, that I can actually play the game), but they are not saved. I've tried moving the files to other folders (started from Resources/Documents, then main Resources folder, Resources/Library/Application Support). It's still not saving the data and I don't know what to do. The result is my statistics not being counted well (it doesn't matter how you answer the questions - all of them are false, because the Xml file is not being updated).
Did anyone run into similar problem?
Can you, please, help me?
I am doing something similar in my own app, using both pugixml and cocos2d-x. So I can confirm this combination works well.
Rather, because on iOS you cannot both read and write the data from and to the app bundle (which is read only), you will need to implement a simple check in the writable document directory - If you a saved file there, load it, if not, load from the app bundle.
So in essence for loading, if your saved filename is "my_save.xml", here is an example flow:
1) Construct a path for your save file in the writable folder by concatenating the writable folder path + your filename. CCFileUtils should have something like getWritablePath() for that.
2) if the file exists in the folder, load it. Otherwise, go to 3).
3) Construct a path to your original data file from the app bundle, using CCFileUtils::sharedFileUtils()->fullPathForFilename(). Load the file from there.
For saving, simply do step 1 and save the file there.

How to embed images and sounds in an iPhone app?

I am having a real hard time understanding how to embed many images and sounds in an iPhone app. When I say embed, I mean I want the images and sounds to be downloaded with the app, and some of those images will appear when the app is run. Other images are just saved in the app's disk space, so that when a user presses a button, the image or sound will be accessed and displayed or played.
I have read tutorials on using 'core data' and such, but that only seems like a way to create objects that can be used to reference such data items, or for storing small files as binary data. Can someone please tell me how in xcode I can specify a directory of images and .mp3s to be loaded onto a phone with my app, and how I can then call those media with code?
Some example code for the following would completely solve my problem:
An app is loaded onto a phone, and it contains 3 buttons. If the user presses button #1, a sound is heard. Button #2 plays a different sound, and button #3 changes a UIImageView to a different picture. (this isn't a homework assignment or something, but if I could code this example, I could do everything I need to in my app and understand the process)
Thanks!
I mean I want the images and sounds to be downloaded with the app
Simply add the images and sounds to your project. Make sure you specify (in the Add Files to Project dialog) that they are to copied into the project and that they are to be part of the target. The result will be that the images and sounds will be built into your app (in what is called its bundle, in particular the main bundle - see the NSBundle docs). You can then fetch them out, as needed, in code. For example, to fetch an image, use imageNamed:. To refer to a sound, refer to the file as a resource within the main bundle.
Other images are just saved in the app's disk space
That is a completely different matter. You will have to get the images from somewhere while the app runs. There is no way to have the user download the app and the image end up in the app's disk space: the app must populate its disk space, in real time, as the app runs. At the time the user downloads the app, the associated disk space, outside the app bundle itself, will be empty.
For images, see the responses to this question.
Sound is similar to images, but is loaded differently, this tutorial show how to load and play sounds.
For files that are saved after the app is installed, you will need to download and save those files in your code. For starters, see Apple's guide to the iOS file system

forge.topbar.setTitleImage(URL,success,error); dynamic image .. fileCache?

I have been told this is possible to do but cannot get this to work.
Basically I am trying to cache and image using forge.file.cacheURL()
Now I can get the file just fine and display it in the page by creating a new Image object but what I want to do is use this cached image to change the image in the topbar.
When ever I try to do it I get an error saying "file not found" and after reading the docs a little more it seems that trigger may have "src/" coded into the class because if I put just "image/logo.png" the logo.png will show up in the header because its part of the app package.
I guess the question is.. Is my assumption correct?
Thanks!
The native UI elements (topbar/tabbar) load images directly from your apps package, not through a URL in the same ways images are shown in the webview.
What this means is that currently you can only use images included in your app in the topbar/tabbar modules.
in case anyone is interested in this, the ability was added a while ago to the API so you can now use a cached image or filesaveURL feature of forge to change the header image dynamically.

Resources