Accidentally deleted Bridging-Header.h file - objective-c

I accidentally deleted Bridging-Header.h file from my project and move to trash. Now if i am running the app it is showing an error "Bridging-Header.h' does not exist"

Select the project in the project navigator
Select the target in the project window
Select Build Settings
Type bridg in the search field
In the line Objective-C Bridging Header memorize file name and path.
Press ⌘N
Create new Header File for the proper platform
Name it according to the memorized file name and save it to the memorized path.
And you are strongly encouraged to use Source Control. It's worth it ...

Related

How to sync localized storyboards' strings after modifying storyboard in Xcode 5

I'm just starting to look at IOS Apps' localization in XCode 5 and I've tried to add an Italian Localization:
Xcode 5 automatically generates the Main.strings file with a single entry, for the only label I've put within the Main.storyboard file:
/* Class = "IBUILabel"; text = "Label"; ObjectID = "PeT-4z-NSf"; */
"PeT-4z-NSf.text" = "Etichetta";
If I later modify the Main.storyboard file adding a new button to the view, then how should I tell Xcode 5, if possible, to add missing localization strings to the Main.strings file? Should I add a new entry by hand by looking at the Object ID field in Interface Builder (it works, but I don't know if this is how it is meant to update storyboards' localization)? Can I run something like genstrings on the Main.storyboard file to extract all the labels' text and add the new ones to the localized Main.strings files?
Check out ReMafoX, it's a Mac app that perfectly solves your problem. It can be easily installed and integrated within your project, watch this video for a detailed walkthrough.
Alternatively, if you prefer an open-source CLI tool without a GUI, you can also use BartyCrouch.
Install BartyCrouch via Homebrew:
brew install bartycrouch
Alternatively, install it via Mint:
mint install Flinesoft/BartyCrouch
Incrementally update your Storyboards/XIBs Strings files:
$ bartycrouch update
This will do exactly what you were looking for.
In order to keep your Storyboards/XIBs Strings files updated over time I highly recommend adding a build script (instructions on how to add a build script here):
if which bartycrouch > /dev/null; then
bartycrouch update -x
bartycrouch lint -x
else
echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi
In addition to incrementally updating your Storyboards/XIBs Strings files this will also make sure your Localizable.strings files stay updated with newly added keys in code using NSLocalizedString and show warnings for duplicate keys or empty values.
Make sure to checkout BartyCrouch on GitHub for additional information.
The file that Xcode does not update automatically (at least 5.x version didn't) is the app's Localizable Strings. You can build a fresh file from Main.storyboard as follows:
In the project Navigator (the leftmost pane) click on the Main.storyboard file. In the Utilities pane (the rightmost pane) click on Show the File inspector icon. It is the leftmost icon in blue in the image below:
.
On the right pane that will appear, one of the sections will be Localization:
Uncheck the English (Localizable Strings) row and in the window that will pop-up check the Delete localized resource files from disk and click the Remove button (you do not have to check delete, in which case Xcode will ask for a permission to override it when you build it next).
Then check English (Localizable Strings) again to build it from scratch.
Using Xcode 6 the following worked for me:
I changed the localization for a language from "Localizable Strings" to "Interface Builder ..." like suggested at the SO question posted by h.orim. However the setting did not change, it still was set to "Localizable Strings". The next step now is to do that again, so Xcode will find the Storyboard it just created and show a prompt asking if it should be used or replaced. Now click on "Use file" instead of "Replace", otherwise the same will happen again.
Now you should have a localized Storyboard in the desired language. After you now switch back to "Localizable Strings" you will have a file containing all current strings used in the storyboard with your previous translations still in place.
Another way is to do it manually by selecting on the storyboard the field to translate. Go to the "Identity Inspector" and copy the Object ID (something like HP8-op-SmX).
After that, open the storyboard langage file (Main.strings, most cases) and past the Object ID. Depending your needs, you just have to add .text or .placeholder.
"HP8-op-SmX.placeholder" = "My translated placeholder text";
"HP9-op-VvD.text" = "My translated text";
Save, clean & build. It's a little bit painful but can save a lot of time if you only need to translate few things.
You can use a script called UpdatStoryboardStrings for this!Get it here: https://github.com/AppliedIS/iOSL10n
Intructions for use: http://blog.appliedis.com/2013/05/22/localization-of-an-xcode-ios-app-part-2/
With Xcode 6+, ideally developers should not have to manually manage strings files. Use XLIFF export to automatically gather development language strings to send to translators, and then use XLIFF import to update the strings files with translations.
https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html#//apple_ref/doc/uid/10000171i-CH5-SW9
Another option is to use ibtool --export-strings-file directly.
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ibtool.1.html
There are two options:
Option 1
Xcode can "reload" the file by converting the file to either an [Interface Builder Cocoa Touch Storyboard] file type or a [Localizable Strings] file type.
Select your base storyboard file from the Project Navigator
Find the Localization section in the File Inspector
If your file is currently a [Localizable Strings], change it to [Interface Builder Cocoa Touch Storyboard] or vice-versa.
Xcode should have converted your storyboard to the current version, while preserving your old localization efforts. Here you can change the file back to the original file type if you would like.
Option 2
Use ibtool to extract the strings in your storyboard.
Open the Terminal application
Locate your Base.lproj directory
Use this line to extract the strings:
ibtool MainStoryboard.storyboard --generate-strings-file file_name.strings
After ibtool extracts the strings to file_name.strings, you can copy and paste it to your original .strings file
Tested with Xcode 11, you can simply deselect the language.
Do not delete the file on disk.
And then choose to use the existing file.
The old translations will be kept and the new keys will be added.

Embedding an image as a resource in a FireBreath plugin

While using VS (2010), I used to be able to add an image as a resource simply by going to the Resource view and then: Right click project > Add > Resource > Import.
I even asked a question about how to then load it: Loading an image from a resource embedded in a dll, but that changed for some reason.
Now when I try the same thing and save the .rc file, I get this message:
"The resource script FILE_PATH.rc was not created using Microsoft
Visual Studio. Comments, macros, preprocessor directives, and
conditionally included information may be modified and/or removed from
this file during the build process. Replace existing file?"
Even if I click "yes" (in order to just test things) then I get all kind of error messages at compile time:
ResourceCompile:
gen\firebreathWin.rc(8): error RC2144: PRIMARY
LANGUAGE ID not a number
gen\firebreathWin.rc(16): error RC2135: file not found VS_VERSION_INFO
etc...
I have two questions:
What is the correct way to add an image resource which will be added to the compiled plugin using CMake? I searched about it and couldn't find any helping information.
What can be the cause for this change in behavior? since I was able to use the same exact steps before and it worked.
Thanks.
First of all, I wouldn't do this; instead, I'd just put the file in the same directory as your DLL and use the path of DLL to find it.
That said, the "correct" way to do this would be to see what changes are made to the .rc file when you add it in the IDE, copy the .rc file from gen_templates/ in the root of the firebreath directory into your project, and then make those changes to your copy of the file. Any changes you make to the generated file will be overridden any time cmake is run again, which can happen any time your cmake files (CMakeLists.txt, *.cmake) change.

Icon specified in info.plist not found under the top level app wrapper

I'm trying to upload my binary to iTunes Connect using Applicaton Loader. When I select the file and hit send, it sends for about a second and then this error pops up,
Icon specified in the info.plist not found under the top level app wrapper: Default -Landscape#2x~ipad.png
What does this mean? How do I fix it?
Another setting that can cause the issue:
You have to make sure the icon files are also found under build phases/bundle resources
Edit your projects .plist file "as source code" i.e. open it in any old text editor. Then manually edit the icon file names until they make sense.
The .plist is case-sensitive when validated and archived for upload to the App Store.
If you have this in the .plist:
icon-72#2X.png
the file name can not be
icon-72#2x.png
owing to the the case change of the x character .
I rename the file and corresponding change the name of icon file in the info.plist and this solution works for me.
Clean your build
Make sure the file is actually on the file system
Make sure you can see the file in the project navigator.
Most likely step 3 will fail. If so, drag the icon from the finder onto the Project Navigator. When asked, uncheck the "copy ..blabla" option because since the file is already there where you are dragging it to, it would fail. Once the file shows up in the Project Navigator you should be golden.
Also check that you dont have 2 icons with the same name anywhere in your project folders.
I am thinking that the answer to this question will vary in time because Apple constantly changes the application validation rules. These validation rules will surface only when you are submitting your app to the AppStore.
In this particular situation, the validation error happened to me while uploading the app on 08/03/2012.
The solution was fairly straight forward. I had to move to icon files which I had located in a folder nested within the project directory all to way up to the TOP LEVEL project directory - one that has the project file in it. Once I did that and readded the files back to the Resources in my project the validation error went away.
Of course you should check that this issue is not caused by misspelled filenames i.e. differences between your plist file and true names of icon files on your file system.
Another little issue that caught me out was an empty string. I got the cryptic failure message ...
Icon specified in the info.plist not found under the top level app wrapper:
And found this lurking in my plist
<string></string>
I was similar problem's. I have resolve to do this
1/ delete your application Icone in your Target
2/ rename your icone ex: applicationNameSmall.png
3/ add your icone in your application.
This, works for me.
Error is coming up because the App Store is checking names of icon files based upon yourProject-info.plist. If they don't match, error message.
To resolve this issue: Go to yourProject-info.plist in xcode and check BOTH "icon-files" and "icon-files(IOS5)" arrays. You'll want to make sure that each string corresponds with the icon files you have in the file directory.
Change or delete mismatched string names (I had to delete a blank string). Rebuild. As other posters have noted, names are case-sensitive, so be mindful of that too.
Sometimes Icon.png files needs to be open in some image editing tool (e.g Adob Photoshop) and save as a new image. This works fine. Check attached images some times image properties don't change by renaming image file manually.
I had the same issue. I just added the image files it complained about to the project in the viewer. Not sure if that was the right thing to do, but it resolved the issue for me.
I had a silly mistake, in my info.plist the i had Icon.png, and the real file name was icon.png (no uppercase)
Fix the images issues it suggests.
Clean your project.
Build and run to make sure nothing has broken.
Delete the previous archive
Make a new archive (Product -> Archive)
This worked for me. I had to rearchive my application cause the previous one was not updated.
I had the same problem. I gone to Targets->Build Phases and deleted from there old (test) icons which I had pushed early. Good luck:)

Cannot create localizable strings files copies in XCode4

I have a "Resources/en.lproj/Localized.strings" file, with some key/value pairs in the format:
"key"="value";
I select this file and in File Inspector in the Utilities Pane I choose to add a new localization (es) pressing the '+' button in the Localization tab.
This action should create a new file "Resources/es.lproj/Localized.strings", but instead the original "Resources/en.lproj/Localized.strings" now displays a small triangle at the left ( as if it were a folder ) and holds inside two files Localized.strings (English) and Localized.strings (Spanish). No es.lproj directory created.
I have never read of this behavior even in references to this using XCode4.
What I'm missing?
Updated info:
I have checked the app bundle installed in my iPhone Simulator and the folders are created there, with the corresponding files.
I don't know if this is the default way but is confusing to me since reading the documentation this is not what I understand.
Your could try this : Quit XCode, relaunch your project. Remove all localizations from your project properties (keeping the files when asked), add them back, remove es localization on your file, then add it back.

How to stop huge Prefix.pch.gch file from being copied into application bundle

For some reason, XCode has decided to start copying a huge Prefix.pch.gch file into my application's resources folder when building. This file is not in the Copy Bundle Resources build phase, nor can I find any other project setting that should tell XCode to do this. Has anyone seen this before and know what's going on?
I had a problem with the same symptoms today, it turned out that it was due to one of my objective C files being included in the Copy Bundle Resources files phase of the target (either due to a drag and drop accident, or the xcodeproj file getting corrupted at some point). GCC was then helpfully including the precompiled headers for the prefix header in the target as there is a dependency from the source file.
Doing a Get Info on the source file in question didn't show all the tabs on the file info dialog, even though the file type was set to sourcecode.c.objc.
Removing the file from the project and re-adding it cured the problem.
You could try doing "Show Package Contents" on your xcode project file in the finder, then opening the project.pbxproj file in a text editor (not xcode).
If you search for ".pch" and/or ".gch", you might spot something.
Are there any Copy Files phases?
Is the Prefix.pch.gch file in your project's group tree? The easiest way to check this would be to select the project object, then search for “gch” in the Detail view.
I solved this problem in a different way. Firstly I like to make use of the prefix file so I have lots of includes for standard logging, colours etc.
For every include to the prefix file ensure that each include is only processed once! This can be done by putting:
#ifndef __<Classname>__
#define __<Classname>__
< your original header file here >
#endif
If you select the "Project" item of the "Project menu and then the "Detail" tab view and then select the project in the "Groups & Files" list on the left is the files listed on the right view have a checkbox? and is that checkbox checked? if so then un-check it.