I'm using base internationalization to internationalize my app. Once I used it, my storyboards became red in "copy bundle resources" (they were normal before I used base internationalization):
I have tried Xcode Copy Bundle Resources can't find files, Base internationalization and multiple storyboard not working right and Base Internationalization and “Could not find a storyboard named […]”. unfortunately, none of them worked for me.
how can I make it normal?
edit
this problem still exists in xcode5
Make sure you have all the "Localizable strings" checkboxes ticked in the file inspector when the MainStoryboard file is selected.
I had a problem that looks similar. I transitioned my project's main storyboard to use base internationalization. When selecting the MainStoryboard file, in the file inspector, I saw a new entry called Base, which was using the English localization. So, thinking that "Base" already accounted for the english part I unchecked the English "Localizable Strings" entry in the file inspector. Apparently that was the origin of my problems. After that, the MainStoryboard file would show up in red in the "Copy bundle resources" list. Checking again the English localizable strings entry fixed the problem.
Unchecking "Localizable Strings" may need also first copy your storyboard elsewhere, then do the uncheck and then import your storyboards again in your xcode project.
Related
my English level is limited, it may be difficult to read, please understand.
I use the NSSidebarTemplate icon in the ToolbarItem control of the project. But every time you open the Xcode, will be lost, there is no way to use NSSidebarTemplate. The missing results are shown in the picture. Open the project will have a pop-up box prompts, probably meaning
The document "Main.storyboard" had an internal inconsistency that was
found and repaired.
I have no way to use this NSSidebarTemplate, but most of the other icons do not have such a problem, such as NSActionTemplate is normal
It comes from a template project from Apple. The image name is NSSidebarTemplate. You can see it by digging into the storyboard or xib xml:
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSSidebarTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="zzz-zzz-zzz">
There might have been a change in Xcode that made the image name displayed as 'Unknown' at some point, though internally it's still there.
This is also discussed here: The Sidebar Icon image name in OSX
1.has selected project.
2.It does not exist any storyboard or xib file include launchScreen file.
3.The project has proceed for a long time.
how can i implement multiple language.
screenshot:
Documentation screenshot:
I read the official document about that and i found this.
I watched the "What's New in Interface Builder" session video and tried to replicate the code that was showed but unfortunately when I assign a view to my custom class which has #IBDesignable I get 2 errors:
Main.storyboard: error: Live Views: Failed to update auto layout status: The bundle “swiftTest” couldn’t be loaded because its executable isn’t loadable.
Main.storyboard: error: Live Views: Failed to render instance of _TtC9swiftTest14ControllerView: The bundle “swiftTest” couldn’t be loaded because its executable isn’t loadable.
Later on in the video I saw that to have Live Views you have to make these steps:
1. Create framework
2. Create class
3. Mark as designable
How do I make the 1st step?
Thanks
As I understand it at the moment (prior to Xcode 6 Beta 3), #IBDesignable will only work from a view declared in a separate framework target.
However, I also struggled to add it because I had no "plus" button as described in various links (because the Hide Project & Target Lists arrow option was toggled off).
So, select your current project target, then just use the xcode menu options:
Editor > Add target...
Then select
Framework & Library > Cocoa Touch Framework etc.
By the way, to test #IBDesignable, this tutorial worked perfectly as a starting point:
http://www.weheartswift.com/make-awesome-ui-components-ios-8-using-swift-xcode-6/
One small but important thing to note in that tutorial (if you follow it onscreen instead of following on to its full github code listing) is that your view class must be prepended/decorated with #IBDesignable, e.g.
class CustomView : UIView {...}
should be
#IBDesignable class CustomView : UIView {...}
You should make new framework as a target for current project and add your live views in this framework. On General tab on main target you will see your framework in Embedded Binaries section.
I had a project with live views working and at one point I also had these error messages. This went away for me when closing XCode and restarting, fwiw.
It is working very well (and easily) for me with Swift in Xcode 6 Beta 5.
I've confirmed that with Xcode 6 Beta 5 I did not need to add any frameworks (for example, Cocoa Touch framework option under frameworks in the dialog that appears when adding a new project target). Nor did I need to add IBDesignable.h to the project. Both seem to be outdated requirements as per the the weheartswift.com write-up linked in the initial answer to the question.
All I needed to do was:
Prefix class definition of my custom Swift class source file
with keyword #IBDesignable
Prefix vars I wanted to show up in IB Attributes Inspector with #IBInspectable (IB recognizes several common variable types).
Then, after assigning my custom component's (UIControl subclass) name to IB's "Class" name file (under Identity Inspector tab, in right pane) replacing "UIView" -- e.g. the class name of the UIView placeholder object I originally dragged onto the IB VC's view -- upon selecting my custom component from the Content View component list in IB, I saw all my custom class' inspectable items show up in the IB Attributes Inspector!! Very cool.
Note: At first XCode would only allow me to prefix one variable with #IBInspectable. It showed errors on subsequent ones. Then, suddenly it seemed to work, and no more problems after that. Not sure if it was a typo or just took Xcode awhile to re-index my project and pre-compile or parse the code.
I code about #IBDesignable & #IBInspectable,
firstly, I got two errors like you,
then, I change the code I wrote,
you can checkout the code from my github
Good Luck.
Maybe this is a hot question, but I had a strange issue (or more probably it's me :) ). I'm trying to use the new localization workflo in XCode 4.5. The procedure I'm using is the following:
Create a project
Localize MainStoryboard with the base language.
Add new language.
So now I have three folders, for example:
base.lproj
en.lproj
it.lprj
I have MainStoryboard.strings in en.lproj and it.lproj.
This is cool...
I noticed that .strings files are not auto filled while I'm modifying the layout (add, remove buttons, labels etc.).
I noticed that the .strings files are filled just when I localize the storyboard. To add new changes I need to remove localization and re-localize.
Doing so I loose my previous changes, i.e. I need to translate all the strings again.
What is wrong in my procedure?
I alos tried using a .sh in the Build Phases section, that auto-update .strings files, but the problem is the same, each time the files are update I loose my translations... (this sounds logic).
Thanks
The trick is to convert your localized strings file to a localized storyboard file in the Localization area of the File Inspector.
.
After that you can convert back to a strings file and you won't lose your translations.
You can do this two ways. It sounds like you have created localized versions of your storyboard, which is fine, but you will have to un-check the localization box for Italian if you make changes to the Default (English) storyboard. Then re-check the Italian box to make the Italian storyboard pick up any changes that you made to the English storyboard.
or...
You can just use Localizable.strings files with a single storyboard, and programmatically handle all of the text using the NSLocalizedString(#"KEY",#"comment") method. After you create your initial Localizable.strings file, just localize it and add your Italian translations to the file in it.lproj.
Hopefully this makes sense. There are really two different localizations happening here. The first is allowing the system to choose the appropriate storyboard..that is typically used when you have translated text in the storyboard. The second is using the appropriate Localizable.strings file for the text values in you app.
Check out our app which can create 40+ Localization.strings files for you (including the translations). https://itunes.apple.com/app/generate-localizable-strings/id572287184?mt=12
Stanford put out for free a series of videos and handouts for their iPhone programming course. I've played around with the first assignment, but all I get on the Simulator is a blank screen. Here's the recipe I followed; what am I missing?
In Xcode, create a new Window-Based iPhone application.
Open the project’s MainWindow.xib file with Interface Builder.
Add the following user interface elements to the view:
a text label
an image view
Set the following properties on the text label:
text value should be “Hello Stanford!” (or something suitably amusing)
text alignment should be centered
adjust the size to make the text large
Back in Xcode, add an image (.png or .jpg) to your project. You can use the Project > Add to Project... menu to select an image. Note: Be sure to check the “Copy items into desti- nation group’s folder (if needed)” checkbox.
Once your image is in the project, return to MainWindow.xib, select the image view and set the image for the image view that you dragged in previously using the Attributes Inspector.
Configure the image view’s “Mode” to be “Aspect Fit”
In Xcode, build and run your project in the simulator.
Been there, done that, but no t-shirt. Seems to me I'm missing connecting lines in the Interface Builder, but I see nothing in the recipe about that.
Since you didn't provide a link, I'll assume you're talking about this document.
Works for me on XCode 3.2.3/Snow Leopard 10.6.4. I created the project as iPhone-only, as opposed to Universal, but it shouldn't make a difference for your purposes.
Try again from scratch, or take a look at my project here.