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
Related
How can I add font style in my coco2dx app while it is on the fly?
For example the font will be downloaded from the server, after downloading the font, the downloaded font will be use in a specific Label in the app.
I know how to add font style in cocos2dx app. it should be added in the info.plist file and in the resources folder.
my problem is I need to add the font downloaded from the server in the info.plist file and I don't know how to edit the info.plist file while the app is running. And base on this it is not possible. is there other way?
sorry for my bad english. please help, thanks in advance :)
I am currently programming an application for AppleWatch which display notifications.
However, the name of the app is too long to appear correctly in sash title.
I want to rename it.
In some post, i saw that we must change the "bundle display name" of the watch app info.plist.
But it does not work. How can i make this change ?
In your project there is the App folder and the Watchkit Extension folder, each of which contains an Info.plist file. Change the Bundle Display Name in "App" folder.
I'm referencing Xcode 7 Beta 6(7A192o).
I'm trying to submit an iOS app to the App Store (one that supports the new Apple Watch) and I'm having major issues with the required icon files, their names and sizes. I've read the documentation (https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/WatchHumanInterfaceGuidelines/IconandImageSizes.html#//apple_ref/doc/uid/TP40014992-CH16-SW1) and it says to create icons #2x of sizes 48, 55, 80, 88, 172, and 196. What does this mean, Icon-48x48#2x.png (96px x 96px) or Icon-24x24#2x.png (48px x 48px).
When I submit my binary it keeps giving me errors... ERROR ITMS 90394 Missing Icon ... ERROR ITMS 90392 Invalid Icon
Could some please explain Exactly what icon names and sizes I need to include please?!?
I've guessed and checked for hours ... Icon-48x48#2x.png (88px x 88px) is no good ... Icon-24x24#2x.png (44px x 44px) is no good!
Also, do I add the icon files to the WatchKit App Extension or just the WatchKit App?
Go to your story board, open your WatchKit App folder, click on the Image.xcassets in there you should see the AppIcon asset, click on it and it will show you all the icon sizes. If you click on each one, the attribute inspector will give you the pixel dimensions for each.
I was also struggling with the same problem. It's really annoying one. Searched for it and did all things mentioned above and in sone other posts over Internet. Though nothing worked.
Well then i realised 24x24#2x should be actually of size 48x48 pixels not 24x24 and so on. I know it's a dumb one. But i guess there are more dumb people like me and this post will help them.
You should definitely import the icons into WatchKit App.
There should be one predefined image asset named "AppIcon" where you should add your icons. It worked great for me, I just updated my app to App Store review.
Btw, you should import all images that you use in AppleWatch app into the WatchKit App instead of Extension, otherwise you the images are sent from iPhone into AppleWatch when the Extension communicates with the WatchKit App...
After many many attempts I finally was able to successfully submit my watch supported app to the store.
I'm unsure exactly which part was causing the issue, but one thing I did was use the naming convention outlined (by mrdoktor) in this thread: Invalid Apple Watch icon file names must match pattern "*<dimension>#<scale>x.png"
Note: I only named the watch app icons in this manner ... the regular icons (for iPhone/iPad) are named like icon72#2x.png etc.
I then went into Xcode's organizer->projects and deleted the "derived data" for the project.
Also, in my WatchKit App I have an images.xcassets file and to it I created a "New App Icon" set which I named "AppIcon-Watch". I went into my project's settings and under the WatchKit App target I made sure that the App Icons Source was pointing to the newly created "AppIcon-Watch" set.
I did not have to touch the WatchKit Extension and it's images.xcassets. I did not have to add the icons to the extension either.
I did have to add the watch icon files to the WatchKit App folder and import them into the project, and further drag them into the correct place within the WatchKit's images.xcassets
I hope this helps everyone else that is having this same issue!
I was getting the 90392 error, not from my app icons but from three other miscellaneous images I included in my watch app. I had added them directly as files in my project, which is the old school way before image assets. I deleted these and added them to an image asset catalog instead and then the app submission went through. The files and filenames were the same, so apparently all images must be part of an asset catalog.
I got the same issue and successfully fixed it. The most strange thing is that icon named in manner 40x40#2x.png should be only home screen 38mm. As soon as I named it in this manner my App was successfully uploaded to AppStore. But ALL MY OTHER ICONS for AppWatch are named as usually: icon_180.png
Magic which is not understandable for me. :-)
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.
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.