Resource problem - Localization and iPhone/iPad XIBs all broken - iphone

I had a localized universal application. I copied a bunch of resources (XIB) files from an old project into the appropriate locations (English.lprog) directories for both iPhone (Filename~iPhone.xib) and iPad (Filename~iPad.xib). I added them to the project, and they all appear correctly in Xcode, as localizations, etc. I can open the localized files for each device in XCode/IB, and everything appears correct.
Now, when I run the project - everything is completely haywire. In short, when I run in English on the iPad simulator, I get the Chinese version of the iPhone XIBs!!!
I can't figure out what the problem is - any idea how to dig deeper?!

Few things fixed this:
Total clean build of project
Erase old application from device and/or simulator before reinstall.
Just because the icon in XCode looks like an IB icon, and double-clicking opens in IB, it still MUST have an ".xib" extension visible on the file.
Simulator is NOT case sensitive, but iPhone IS. This includes differences like MyClass~iphone.xib (works) vs. MyClass~iPhone.xib (doesn't work).

These steps have worked for me: In Xcode,
Check the location of folders for every language
Build > Clean all targets
Build > Compile
alt-R

Related

Storyboard file 'MainStoryboard_iPad~ipad.storyboardc' was not found

I am attempting to validate my iOS project before uploading it to the App Store. It's an iPhone app that runs fine in the simulator and on my iPhone test device. It works fine in iOS 6.1 and iOS 7.
When I run the Validate check in Xcode Organizer, I repeatedly get 1 error and 1 warning.
Error is:
Storyboard file 'MainStoryboard_iPad~ipad.storyboardc' was not found. Please ensure the specified file is included in the bundle with any required device modifiers appended to the filename.
Warning is:
Missing recommended icon file. The bundle does not contain an app icon for iPhone/iPod Touch of exactly '120x120' pixels, in .png format.
I have spent days (weeks?) searching for an answer to similar questions that might resolve the error message. Nothing works ... and I've tried a lot of things that seemed to have worked for others.
Perhaps there really is something wrong in my code / bundle creation ... help! I can't find it. Since I get the same 2 messages every time I try and validate the project, no matter what I change, I'm starting to wonder if, somehow, the changes I'm making are not making it through to the bundle that is getting validated each time?
Goto your Project view, click Targets, goto General tab and look at Deployment Info settings.
In the Devices selection box, you will see iPhone in your case.
Perform the next steps:
select iPad
Delete the text Storyboard-iPad in the 'Main Interface' Choice box so it is empty
Press cmd-s to save (If not saves automatically)
select iPhone again in the Devices selection box
Build your project again and archive it again 5.
Problem should be solved now.
To fix the error, just open the project's info.plist file and remove the value for the key Main storyboard file base name (iPad) (or UIMainStoryboardFile~ipad).
Also, you should be able to fix the warning by adding an app icon of the size/type specified in the warning message.
Don't forget to re-archive after making these changes.
This happens, when you change the default storyboard name for iPhone App (even you not targeting to iPad).
In Project > Targets (App)> General > Deployment Info
Just change Device to iPad and then select the default storyboard of iPhone.
Change back Device to iPhone
I have exact the same problem. I'm working on a universal app that has 2 storyboard (both iPhone and ipad) and I accidentally deleted the iPad storyboard while I was making the localisation, then I re-added the iPad storyboard(maybe I did it incorrectly), the next time I submit the binary, the Error-itms-90029 occurs(gone through the validation but failed at the submission, strange case aye~).
I solved this problem by once again deleting the the iPad storyboard, and again re-insert it. and now it is fine. careful when you re-insert it, you also need to check it in the "Build Phases >> Copy Bundle Resources", if you see the storyboard icon showing properly then it is fine.
I stopped trying to resolve the error messages I was getting in the Validate step and began following my hunch that the bundle changes I was making were not getting through to the bundle that was being validated. I read posts about how to create an Archive "ipa" file. Following those instructions, I was able to create a new and up to date ipa file that did validate and I was able to upload to the App Store for review.

XIB not loading on iphone but in Simulator

When I run my app in the simulator it does load the xib file and all looks perfectly fine. As soon as I run in on my iphone4 I get a white page with "My Universal App on iPhone" but not my xib file.
how comes?
Try this: Clean all targets, delete Build folder and uninstall app from device.
It happened to me once too. Try to clean your project (cmd+maj+K).
Try to use the function InitWithNibName:#"YourNibName" without misspelling in YourNiBName.
Good luck
Check that the .xib file is still part of your project and set as a resource to copy at build time. This sort of thing tends to happen if you've removed a file from the build resources but there's still an old copy in the simulator's build directory.

iOS universal app localization xcode 4. bug?

well, i've just faced with localization problem on my projet and decided to make an experiment to reveal the problem:
experiment:
create universal iOS application;
change the text on main windows from "My Universal iPhone (iPad) App" to "Hello" both for MainWindow_iPhone.xib and MainWindow_iPad.xib files;
build and run app in iPhone and iPad simulators - both displaying "Hello" message - everything is fine;
add spanish localization for MainWindow_iPhone.xib and for MainWindow_iPad.xib (english localization was already there)
change the text on main windows from "Hello" to "Hola" both for spanish version of MainWindow_iPhone.xib and MainWindow_iPad.xib files;
change language in simulator to spanish;
build and run app in iPhone and iPad simulators - both still displaying "Hello" message - what?!?!?!
fix:
open project properties and go to "build phases" tab;
in "copy bundle resources" add xib files: locate MainWindow_iPhone.xib and MainWindow_iPad.xib files in es.lproj directory of project and add them
build and run app in iPhone and iPad simulators - both displaying "Hola" message - OK
well, what conclusion can i make? when adding new localization to xib file, xcode is forgetting to add this file to copy bundle resources target. so after running app on different localization (spanish in example) iOS can't find spanish localization (of course, Xcode forgot to copy it!!!) and load english version of xib.
manual adding localized versions of files makes mess in the project tree - added files will be displayed in project hierarchy, but they are already displayed when we expand xib file with localizations. (in example we will have MainWindow_iPhone.xib and MainWindow_iPad.xib in project structure tree, but at the same time they are available in iPhone and iPad file groups after expanding localized MainWindow_iPhone.xib or MainWindow_iPad.xib files)
or am i missing something cruicial?
If you manually add resources to Xcode, you'll often need to (K)lean your project to rebuild the links. Command-K should do the trick.
I can't remember having to do this in Xcode 3 and it may already be fixed in later version of Xcode 4.

How to localize view in xcode4?

I want to localize my iOS project in xcode4. In xcode4 this seems to be very simple. In the utility sidebar there is a localization panel where I can add languages.
Adding a language I get following structure:
I want to localize a button. So I open MainWindow.xib (German) and just edit the title of the button. But when I run my project on both device or simulator I always get the english version even if it is set to German.
Where is the problem? Any ideas?
Delete the app from the device or simulator. If you've launched it before you've added the localization there is still a MainWindow.xib in the root file structure of the project.
If you deploy from Xcode files are only added, never removed.
So you have three files now.
MainWindow.xib
de.lproj/MainWindow.xib
en.lproj/MainWindow.xib
And as long there is a file in the root folder iOS doesn't look into the language specific folders.
Go into settings on the iPhone or Simulator and change the International from English to German, then restart the app.

Why is app icon white?

Some recent version of iOS caused my app icon to turn white. I've gone through everything in regards to images and can't find the issue. I'm running Xcode 3.2.5 with sdk 4.2. I do have an entry for "Icon files" in Info.plist with 5 keys:
Item 0 myapp.png
Item 1 myapp#2x.png
Item 2 myapp-72.png
Item 3 myapp-Small-50.png
Item 4 myapp-Small.png
Item 5 myapp-Small#2x.png
All the above have proper dimensions.
I see the image in 'Copy Bundle Resources' and also in the .app file for the simulator version. It is properly reference by name in 'Icon files', Item 0. It is not named Default.png since it is referenced by name in Item 0.
Any suggestions?
You just need those 3 Files:
Icon.png
Icon#2x.png
Icon-iPad.png
Put the names into the Info.plist under Icon Files.
EDIT: Clean your target if it still won't work!
That is what helped me (project summary - app icons are ok, iOS simulator - app icons are ok, iPhone device - blank icon).
Just reconnect your icons to project by dragging them from project navigator to App icon section in project summary.
When does it turn white? If you upgrade an app when it's running, sometimes it appears with a white icon in the "task" bar. This applies to apps you're developing and those download from iTunes. The fix is usually just to kill the app and restart.
That's the simplest answer, but I suspect might not be the solution.
Does the case of the file names in your Info.plist match the actual file names? The Simulator is not case sensitive but the iOS is.
You might also like to make a completely clean build. Don't just do a "Clean" in Xcode, instead manually clear out your build folder.
Finally, when the iPhone 4 first came out I had some issues with the order of the icons referenced in the Info.plist. I never saw white icons (usually just the non-Retina version) but this may be something worth playing with if nothing else works.
The icon file name may be too long if it is a custom file name. This is just a guess, and I hate guessing, but this appears to have been the problem I just had.
I have four targets using the same code but with different icons. I named the icons differently based on the app name, so I could store them in the same directory.
For example:
Icon.png
Icon_second.png
Icon_alternate.png
Icon_second_alternate.png (or Icon_secondalternate.png in case underscores were an issue)
This nomenclature was used for all of the icon names (there's 8 icon files to support iPhone, iPad, retina, etc).
The last one was giving me a problem. Despite a hundred clean/rebuilds, deleting the schema entirely and creating a new one, fruitless efforts, it suddenly occurred to me to try renaming it.
You should be able to name the icons differently, as I still use the first three versions. They are listed in the plist file and render in the project summary, and on the simulator, just fine. The last one rendered in the summary as well. However, I think the length of the file name was too long for the simulator. There must be a length limit. I renamed the fourth one to use the standard Icon.png naming but added it to the fourth target only (images are stored in a separate folder).
CONCLUSION: If you have more than one target for your app, use the standard naming system for all of your icons but add them to separate folders, and then when adding to Xcode just set the build target appropriately.
If you still have the default icon entry (even blank), this can happen, remove that entry in info.plist.
Also, Default.png would be your splash screen.
Load the icons into the Preview application, and make sure they are really png format (and not just named such) by doing a "Save As..." specifying PNG format in the save dialog. Do a Get Info to check the sizes. Make sure the case of all letters in the name match your plist entries.
I had the same problem recently - the Icons I was using were created in GIMP. When I opened them in Photoshop on the development Mac it complained about an ICC color profile. After re-saving the PNGs in Photoshop the Icons worked like a treat.
P.s. I just repeated my steps in creating the images in GIMP, but when saving unticked every extra option that GIMP - by default - was trying to add into the image when saving it. The icons worked perfectly this time around.
If you believe your icon configuration is correct, then you may simply be seeing a bug in Xcode.
As a workaround…
"Clean" your project. Choose Xcode > Product > Clean.
Delete the app from your simulator, or even reset the Simulator by choosing iOS Simulator > Reset Content and Settings.
Quit both the iOS Simulator and XCode apps, then restart them.