I have an application with localized XIB files for English and French. When running in the iPad simulator on my development machine the French XIB is loaded when the language of the simulator is set to French and English otherwise, as expected.
It appeared that when running on the iPad it was loading the English language regardless.
I tried editing the English language XIB to verify it was loading the wrong version but this change didn't show up.
In fact the same XIB, which appears to be the pre-localization XIB or a copy of the English language version, loads even though I have:
Deleted the XIB.
Cleaned all targets.
Deleted the app from the device.
Turned the device off and on again.
Verified the XIB is not in the Copy Bundle Resources phase of the target.
Regardless of language or existence of XIB it still loads the XIB as it appeared pre-localization. This file no longer exists in my project.
The simulator, throughout, works as expected. Loading localized resources when present and throwing errors when it can't find the XIBs because they have been deleted.
How do I get the application to use a localized XIB that exists rather than a memory of a XIB that doesn't?
Try delete Derived Data.
Xcode -> Organizer -> Projects -> Derived Data -> Delete...
Everything will be fine.
This is a common issue. Quitting Xcode and reopening the project will usually fix it.
Also, be sure the newly created localized .xib has all the required "Target Memberships"
Related
I'm trying to validate an iPhone app, which is ready to be released after validation. Xcode insists that there must be an ipad file for it though, any suggestions? I would upload a photo, but I don't have enough rep, due to me just starting Stack Overflow.
Likely there is a Main nib file designated in your info.plist file, but you have this resource not included in your application.
If you delete this entry in the info.plist file, it will be fixed.
Could it be, that you have choosen in your Project Settings, that it should be an "Universal" App, if so. Xcode wants two storyboards, one for the iPhone, one for iPad.
If this is the problem, just open your project settings and remove the "Universal" and change it to "iPhone".
I have designed a custom keyboard for iOS8 and it's working perfectly fine on the simulator but when I connect my iPad to Xcode to have the app on my device, it doesn't show my custom keyboard under the keyboards list.
What am I doing wrong?
The implementation of my keyboard could be found here.
After step by step committing code, I found something interesting. In my application I have some web files like index.html, CSS folder JS folder. My application works fine just before copying these files inside of the project. Once I add them and run the program, it won't show my custom keyboard under the keyboards list. I think it's a bug, please correct me if I'm wrong.
Edited
I tried to add folders one by one and test the app after changes. I added JS, CSS folders successfully. I have a folder called plugins. As soon as I add this folder to the project as a reference folder, my custom keyboard will disappear. If I remove this folder, delete the app from device and run it again, my custom keyboard will come back. This is definitely a bug for iOS8.
I'm creating a Cocoa application for 10.6 and newer OSs. I created a brand new document-based application in Xcode 5 (10.9) and changed two settings to make it 10.6-compatible: I changed the deployment target to 10.6 and turned Auto Layout off on both MainMenu.xib and xxDocument.xib, the two default nibs that are included with the document-based template. I archived my application (no code signing) adding no other code and tested it on four different OSs. Here are the results:
OS X 10.9: Launches and shows a new document window ("Your document contents here") as expected.
OS X 10.8: Launches as expected; same as 10.9.
OS X 10.7: Fails to launch; Console applications yields "App Name: Unable to load nib file: MainMenu, exiting".
OSX 10.6: Fails to launch; Console yields same as 10.7.
I'm quite baffled as to the behavior of my application. I added absolutely no code to the template document-based app that Xcode created for me; I just changed the required settings to make it compatible with 10.6 and up. I also tried turning off ARC in the build settings, which made no difference at all. I checked Apple docs and also searched for other questions about the console error I received, but none of them were related to this problem. I was very surprised that 10.7 exhibited this behavior, as 10.7 is compatible with ARC. I would greatly appreciate any advice on how I can fix this problem. I would suspect that there is an easy modification to the default template, as Apple probably wouldn't supply a template that requires extensive modification to merely get it working. Thanks.
UPDATE:
As suggested, I turned off base internationalization in Xcode. I ran the app, and it worked fine. I exported the application (no code signing) and tested on all of the above OSs. This time, the error that I received above occurred for all OSs. This even occurred on the SAME machine that I built the project with, the only difference is that I didn't run it from Xcode. My next step was to actually make a MainMenu.xib file (because removing base internationalization deleted the old one) and set that as the main interface. Now not only do I get the error in the exported application on all OSs, but it shows up in Xcode when I try to run the application! Is there something else that I am missing?
AS mentioned before you need to disable Internationalization Base.
In the Project Navigator Click on the on the first item which is your project (denoted by blue page with white A in it, it is the root of all other items)
You should by default see the Info page to the left (if not select it from the tab at the top)
The last item in the Info property sheet is Localization. Under Localization you will have the ability to add and remove languages and you should by default have two already Base, and English.
Delete both, and deselect the check box "Use Base Internationalization"
Once you have done this, remove the any *.xib files you have from the project itself. MAKE SURE TO ONLY REMOVE REFERENCES !!!DO NOT SEND TO TRASH!!!
Once the references have been removed, go into Finder, Open your project directory and you will find a directory called Base.lproj with your *.xib files located in them. Copy or move them one level up to your project directory, and delete Base.lproj directory.
Go back into xCode and add back in your *.xib files. ++K to clean the project, then ++R to rebuild.
This should move the *.xib files in the App Package from Base.lproj (where 10.6 does not seem to find them) to the Resources file folder, and solve the problem.
Newly created Xcode 5 projects have base internationalization turned on. Base internationalization is supported on OS X 10.8 and later. You'll have to turn off base internationalization to support 10.7 and 10.6. See the following Stack Overflow question for more information:
Base.lproj/MainMenu.xib is not available when compiling for targets before Mac OS X 10.8
Another thing you may need to do to support 10.6 is to set the deployment target to 10.6 for both the project and the xib files. I know you said you set the deployment target to 10.6 in your question, but it wasn't clear if you set it for both the project and the xib files. As you're discovering, Apple's project templates do not place a high priority on compatibility with old OS versions.
I have a project that I created in xcode 4.5 with a target ios of 5.0 and I used Base Internationalization. Base Internationalization moves the nib files to Base.lproj.
The project runs on my iPhone 4 running ios 6 and on my iPad 3 running ios 6. But this error shows when I try to run it on my iPad 1 running ios 5.1.1. In the Build Phase section of the target, the nib files are shown in red.
When I try to add the nib files to the Build Phases bundle resources, they add but they are still red (not found). I have tried every way I know to add the nib files to the bundle resources. How can I accomplish this?
Base Internationalization is only supported in iOS 6. It will cause a crash in iOS 5 or below when it tries to load a Xib.
Note: Strangely, running on Simulator with iOS 5 will work. That should to be a bug.
I have detailed my experience after releasing my app with this dumb startup crash: http://samwize.com/2012/11/22/warning-do-not-use-base-internationalization-in-ios-5/
I did not know that English (en) also must be localized. When I localized English, I was able to load the nib files into the bundle.
I'm still getting 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'MainViewController_iPad''
but at least now it's not because the nib files aren't in the bundle.
I need to add a storyboard to my app for the iPhone5 - as the autoLayout doesn't work for this project.
I created a storyboard from scratch and abandoned it (and deleted the file) when I realised I should have just copied and renamed the existing mainstoryboard file.
The problem is, that when I run the simulator as an iPhone 5, I still get the old deleted views. i have tried cleaning the project etc as suggested here in other posts. I have also checked to see if the old storyboard was saved anywhere silly - and it is not there.
Any idea what is happening?