I am attempting to make a TTF font file available to my main application and also in my photo editing extension. But the font isn't found when I attempt to access it by name in the extension, although it works in the main app.
I've selected the TTF file and in the File inspector I've checked AppName and AppNameExtension to add them both targets. I ensured the font shows up in Extension > Build Phase > Copy Bundle Resources. The font name and extension exists as the first index of an array for the “Fonts provided by application” in the extension's Info.plist. And I am calling it in code by its proper name. Again, it is working in the main app but not the extension.
Did I do something wrong in order for that resource to be available in the extension, is this not possible in the extension, or is this a bug I should report?
It seems you have everything correct and it is possible I had some issues trying to get it to work as well but it turned out I had thoughtlessly selected the font I wanted to use in Interface Builder before I created the "new" font for the extension and it seemed to be trying to reference the font in the container app, I removed that reference and set it programmatically.
You have to be a little more careful debugging with iOS extensions as Xcode doesn't seem to be as "helpful" as it is in the container app in regards to debugging messages, at least in my opinion currently.
Related
How can I use container apps localized strings from shared extension in Swift. I have already added containers strings files into extension -> build phase -> compile sources but its still not working. Should I set anything in configuration? From main container app strings are translated but from shared extension it shows only the string keys/ids for texts.
You need to change target membership of the Localizable.strings file. Select Localizable.strings in the Project Navigator on the left, then open File Inspector on the right and add checkmark next to your extension target in the "Target Membership" field.
There are a couple things to check:
One is the solution offered here by #ovejka - click on your string
localization file and ensure, in the rightside settings pane, that
the file applies to your widget as well as your main app (target
membership).
Another is to ensure that your storyboard strings file, which should
have been created automatically when you added a second language to
your app, has the proper translations.
If neither of those work, given that a widget is quite small and
likely only has few labels, you could add a switch statement to 'viewWillAppear' to translate each label based on the detected language
Finally, none of those seemed to be working for me in the simulator or even by switching the schema language and running it on my actual phone.
It turns out, it was working all along and the simulated language wasn't applying to the widget. I turned my actual phone's language to Spanish, run the new version of my app, and the widget was translated.
I need to programmatically set the Launch Images Source setting in XCode 7 for my app project to Don't use asset catalogs. As I will be using a storyboard.
Important By "programmatically" I do not mean at runtime. It is actually at build time where I have a script file which runs some code that needs to rearrange the project. I knw you might not like this, but this is the requirement/challenge here.
I searched in my project's .plist file but it seems there is no trace of that setting. Where can I find it? Which file is hosting this setting?
It's in the project.pbxproj file.
There's a ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME property that gets set to the name of the file you select.
This isn't possible. The launch images will be stored somewhere in the main bundle and those files can not be changed at run time.
I'm trying to add a downloaded font to Xcode and I've folowed every single step based on this link: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/
I added the font to my Xcode Project,
included it in Copy Bundle Resources (Build Phases),
and typed it in Fonts Provided by Application (in Info.plist).
Then I typed this in GameScene.swift inside didMoveToView
It has worked with other fonts but not with this one. This is really frustrating me and I've got no idea what the problem is, thanks.
The name of the font is not always the name of the file. Try looking for the file and then opening in. It should automatically pull it up in font book, and the name of the font is located on the top bar. Simply enter that instead of the file name and it should work.
i am trying to include a custom font into my project but i just cannot appear to do that. I was able to do it in my pervious projects without a problem.
First of all, when i include a font in to xCode project it appears like this:
I have tried alots of things, and I know the guidelines when adding a new font,I have read a lot of articles like this (Common Mistakes With Adding Custom Fonts to Your iOS App) and done that several times with success, but now it just wont work.
Fonts are included in the project, they are in copy bundle resources and in the .plist file.
Also I have tried cleaning the project, deleting derivated data, I actually created the whole project from scratch, with no success...
xCode version is 6.4
Font in question is Roboto but i couldn't include any other.
Font type is .ttf but i have tried with .otf also.
Any help here?
Does your project name have any special characters in the name? That can cause problems. E.g. question marks...
I am looking to change those two info in XCode showing in the simulator when the App is installed.
Do you know where I should look for (see attached screenshot), the name and the copyright.
I already tried to change the bundle name and target without success.
There's a file called LaunchScreen.xib in your project. It is automatically created as part of the project template, and it shows the name of the project (at the time of creation - that's why you had no luck changing the settings) and the organization name.
You can customize this screen as you wish (e.g. show a logo), or get rid of it altogether - then you need to provide the good old 'Default*.png' files, and indicate in the Project settings that you don't want to use a Launch Screen File.