Im using custom font in my application and have run into very weird issue. The font is available on the simulator but unavailable on an actual iPad.
1 I'm not confusing font name and file name. The file name is bitdust2.ttf whereas font name is BitDustTwo and this is how i call it and on simulator it is ok.
2 The is not a question of case sensitivity. The font is really unavailable on the device. I know that cause when i do this:
NSLog(#"%#", [UIFont familyNames]);
i see that on simulator my font is included in the familyNames array, but is missing on the iPad. What's wrong? Did you ever encounter such an issue?
(From above comment:) Verify that the font file "bitdust2.ttf" has been added to the target and is copied into the application bundle.
The simulator is, as titled, a simulator, and not a true emulator. The simulator runs the same named APIs, but since the simulator runs on OS X, not iOS, the simulator often has more functionality. For example, the media player classes on the simulator support more types of files (codecs) than on the device because OS X supports more codecs than iOS. On the simulator, you have more Fonts available than on the device.
Here's more details about embedding fonts in an iOS app:
There is a simple way to use custom fonts in iOS 4.
Add your font file (for example, Chalkduster.ttf) to Resources folder of the project in XCode.
Open info.plist and add a new key called UIAppFonts. The type of this key should be array.
Add your custom font name to this array including extension (Chalkduster.ttf).
Now you can use [UIFont fontWithName:#"Chalkduster" size:16] in your application.
It's important not to miss any steps. If you're still having problems, go to the Build Phases tab of your project in XCode and under the Copy Bundle Resources tab, ensure that your font file is included. If not, add it.
Check your device OS version as well as its support for iOs versions. The custom font you used must be compatible with iOS of your device.
Check this answer out. May be you need to have alternate custom font in case it is not supported.
I just had this same problem and after verifying everything was correct:
Font is added to proper key in info.plist "Fonts provided by application"
Font is added to project -> info under same key as the info.plist (this just means that i saved the plist)
Font file is added to the project
Font file is in the project folder
Project -> target -> Build Phases -> Copy bundle resources: contains my font file
File is checked off for being associated with target
I had to download the file again and re-add it.. when i did the file name was changed ... so i think the .ttf file was corrupted
You'll need to embed the font onto the app; instructions are here.
Related
I downloaded the new SFPro fonts from this url https://developer.apple.com/fonts/. And I can see that it is properly installed in Font Book. But when I try to use it as System font inside my app's UILabel, it gives me the SFUI fonts instead. (I print the system font with the code below and it prints '.SFUIText')
print(UIFont.systemFont(ofSize: 15).fontName)
How can I use new SFPro fonts instead of SFUI? My Xcode version is 8.2.1 and the software is El Capitan version 10.11.16.
I am successful in using it by following steps:
1) Add font files to your project
2) In your info.plist press on the plus button. Type Fonts provided by application. Add your font files names for example (SF-Pro-Text-Regular.otf)
3) Make sure the font file has your project as a targeted membership by clicking on the file and then ticking on checkmark under target membership section
I want to select "Custom" option from Attribute Inspector of WatchKit Interface for UILabel but its disabled.
Is Any one facing the same problem? Please give me direction if I am missing any thing;
I am using XCode Version 6.2 (6C131e)
The standard iOS fonts are only standard on iOS devices. They are not included on Apple Watch.
The documentation shows this list of all standard WatchKit font styles:
Note the phrase "none installed" in your screenshot.
If you want to use any other font, you'll need to install a custom font. From the WatchKit docs:
To use custom fonts, you must install those fonts by doing the following:
Include the custom font file in both your WatchKit app and your WatchKit extension bundle.
Add the UIAppFonts key to your WatchKit app’s Info.plist file, and use it to specify the fonts you added to the bundle. For more information about this key, see Information Property List Key Reference.
I'm making a simple Apple Watch app, using Objective-C, and I'm trying to use a custom font.
I have added the font to the info.plist, and also the supporting files folder. The font does work in the storyboard, but when I run the app in the simulator it's just the regular system font. Any ideas?
(I haven't used any code to set up the font)
Have you included the custom font file in both your WatchKit extension bundle and the WatchKit app bundle? The reason for this is you need to be able to create strings with the font at runtime (via the WatchKit extension), then the information is sent to Watch and the font from the WatchKit app's bundle is used to render the string on Watch.
Then it's simply a case of adding it to the UIAppFonts key in your Info.plist file as you mentioned.
Apple has documentation on using custom fonts, found here.
Hope this helps!
J
My app keeps getting rejected as an invalid binary after uploading it to iTunesConnect via ApplicationLoader. The e-mail notification I'm getting is:
Your binary is not optimized for iPhone 5 - - New iPhone apps and app updates submitted must support the 4-inch display on iPhone 5 and must include a launch image with the -568h size modifier immediately following the portion of the launch image's filename. Launch images must be PNG files and located at the top-level of your bundle, or provided within each .lproj folder if you localize your launch images. Learn more about iPhone 5 support and app launch images by reviewing the 'iOS Human Interface Guidelines' at /.../
Which is weird as I'm packing all splash screens in the binary, checked that through extracting my .ipa aswell and they are there (in their respective .lproj-s), correctly named and of correct sizes. I do not use the Asset Catalog, as I haven't found a way to localize that (yet).
What could be the issue for the rejection?
I also face the same problem in my case myapp plist file contains key "Launch Image" after remove the key from plist issue fixed on validation.
The issue here seemed to be that it was expected that the splashes would be in EVERY localization folder, even if I didn't localize the splash for that particular language. INCLUDING Base.lproj. After copying the english splashes into default, the app got through the initial check and is awaiting review as we speak.
We faced the same issue and couldn't solve it after trying many solutions, we believe it's a kind of bug in App submission.
But we found a workaround which can keep launch images localized and pass the submission verification.
Environment:
Xcode 6.1 (6A1052c) with iOS 8.1 SDK
Precondition:
Have following properties in your "*-info.plist" file.
Steps:
Go to your target's settings and in our standard scenario (localize
launch images, which uses "UILaunchImages" in "*-info.plist" but not
image assets), it should look like the image
Change the setting to use image assets (Note: after this step, Xcode will automatically REMOVE the "UILaunchImages" properties in your *-info.plist file. So please BACKUP the properties first.)
Go to the "LaunchImage" assets (can click the arrow button on the right) and fill with images from one of your *.lproj folder.
Now, go to the "LaunchImage" folder which contains images and "Contents.json" file.
Remove ALL the launch IMAGES just added, but kepp the "Contents.json" file.
Check the "Contents.json", it should contains properties like image below
Double check following items:
*-info.plist contains "UILaunchImages" properties
Project setting uses image asset for launch images
"Contents.json" in "LaunchImage" asset folder and the folder DOES NOT really have launch images
Now you can have a try for localized launch images and submit the binary to iTunes Connect. In our App, the workaround did work for "localized launch images" and "submission successful".
It should be a trick for avoiding the bug in submission checking.
Since the workaround above doesn't change any resource, except making the checking thinks we use image assets, we are more convinced that there are some bugs in Apple's checking.
Cheers!
I had the same problem. You don't need launch images if running in ios 8. I made a new launch screen as a storyboard and deleted the xib version. Change the settings in Targets -> General -> Launch Screen file to reflect the new file. And make sure Targets -> Info -> UILaunchStoryboardName is updated as well.
I am trying to submit my app to Apple Store but I am receiving the "invalid binary" message, informing that is missing the launch image for -568h modifier. But the file is in the package. I checked. Some details:
The launch image are localized but not for all languages. They are present for English and some other languages.
In the simulator and in the testing devices the launch image is displayed correctly.
I checked the sizes and are correct
I am using XCode 4.6.3
I recently installed XCode 5 preview but I am using 4.6.3 command line tools.
There is no UILaunchImageFile entry in the plist file (I am using the Default name).
The images do not appear in the Launch Images panel (after I localized them).
What is going on? I don't have any clue.
Check your file names are like above displayed image.
Found the reason. If the launch image is localized it is necessary to provide the set of images for all languages the app supports. I tried that and Apple accepted my binary.
Looks like you have to ensure there are also default startup images in Base.lproj. I'm guessing they are used if you are running on a device that has a language not directly supported by the app in the other *.lproj folders.
Can anyone clarify this.
Works for me now anyway.