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.
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 am using User-Defined settings (for example CustomAppBundleId) to change bundle identifier for different configurations. In the app’s plist file I set CFBundleIdentifier to ${CustomAppBundleId}. For Release configuration I use bundle:
com.yourcompany.${PRODUCT_NAME:rfc1034identifier}
and for AdHoc I use:
com.yourcompany.adhoc.${PRODUCT_NAME:rfc1034identifier}
Now I added WatchKit Extension and WatchKit App. For WatchKit Extension bundle identifier I can use the same approach. I also have to change WKAppBundleIdentifier to match the bundle identifier in the WatchKit App. Again, I could use User-Defined settings. Now the last bit is WatchKit App. Unfortunately WatchKit App doesn’t have an option to add User-Defined settings but I need to set the right values for CFBundleIdentifier and WKCompanionAppBundleIdentifier (that is equal to CustomAppBundleId in the app). Is there any way I can do it? Or should I use different approach?
Define your "User-Defined" variables in project's Build Settings rather than in target's. That way you will have the same user defined variables automatically available (inherited) in WatchKit Extension and App target.
Btw make sure you have the latest Xcode 6.3 from the App Store. This version (and most recent Xcode 6.3 beta 4) already allow you to define custom "User-Defined" in Build Settings).
Previous versions were simply missing "Build Settings" tab in WatchKit App target, but if you were brave enough, you could have modify those manually in plain text editor :-)
Update to Xcode 6.3.
In 6.3 you will have additional tabs for target configuration that should provide what you need.
But I'm almost sure you will face issues with the WatchKit App Storyboard.
In the Scenes > Identity Inspector > Custom Class you have to set the correct module - that is not possible if you have more than 1 (if you do not have more than one I would be more than interested in your setup)
I solved that issue with a pre-action script that updates the storyboard XML accordingly
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
I am doing contract work for another company and they finally submitted the build to Apple. I am using a wildcarded distribution profile for TestFlight builds and they re-sign it before submitting to Apple.
I've recently switched to using the Images.xcassets for the AppIcon and everything looked good from Xcode. No warnings about app icons or archiving errors, however, when they submit to Apple it doesn't get past the Meta-data review because of missing app icons. Specifically, the following:
Icon specified in the Info.plist not found under the top level app
wrapper:AppIcon40x40
Icon specified in the Info.plist not found under the top level app
wrapper:AppIcon60x60
Icon specified in the Info.plist not found under the top level app
wrapper:AppIcon50x50
Icon specified in the Info.plist not found under the top level app
wrapper:AppIcon72x72
Icon specified in the Info.plist not found under the top level app
wrapper:AppIcon76x76
iPad:AppIcon57x57.png: icon dimensions (57x57) don't meet the size
requirements. The icon file must be 72x72, in .png format
All the other icons (building for iOS 6/7 universal app) appear to be fine. I made sure the .xcassets was part of my target and all the other various suggestions here.
So I opened up the .ipa and Payload to check out what Xcode had done. With the exception of AppIcon60x60, it changed the names of my files to AppIcon40x40~iPad and simliar for the rest of them. AppIcon60x60 was actually called AppIcon60x60#2x (which makes sense because it is 120x20 px). The file names in the Info.plist did not contain the ~iPad suffix for the iPad icons, which I feel lead the the issue of rejection.
I was under the impression when you use the Images.xcassets that Xcode would automatically name the icons and fill out the Info.plist appropriately. I am left wondering if it is a problem with archiving the app with a wildcarded distribution profile.
I eventually got the submission to be a success by removing the Images.xcassets and manually assigning the icons and then going into the Info.plist and deleting a few extra entries that were lying around. Any input would be appreciated, thanks!
From the iOS 7 UI Transition Guide:
Note:
An asset catalog contains resources that are displayed within a napp; an asset catalog doesn’t
hold the app icon, launch image, or any other image that an outside
process needs to access.
I moved these files out of the xcassets, restored the .plist Icon Files, and worked.
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.