Open jemgold opened 10 years ago
You didn't use those workaround macros, right?
Nope - just the +iconFontWithSize:1
workaround
When this assertion is failed, it means the font file doesn't exist in the app bundle, maybe you removed the font file from the "Copy Bundle Resources" build phrase accidentally. You can also try to clean the project and Xcode derived data, if you're using CocoaPods, try to reinstall. By the way, are you using any font related stuff?
Thanks, will have a go with those suggestions - in the meantime I switched to a different FontAwesome implementation but will make some time to switch back :)
Jon Gold
jon.gd +447722118382
On 7 August 2014 16:35, Pride Chung notifications@github.com wrote:
When this assertion is failed, it means the font file doesn't exist in the app bundle, maybe you removed the font file from the "Copy Bundle Resources" build phrase accidentally. You can also try to clean the project and Xcode derived data, if you're using CocoaPods, try to reinstall. By the way, are you using any font related stuff?
Reply to this email directly or view it on GitHub https://github.com/PrideChung/FontAwesomeKit/issues/26#issuecomment-51488892 .
I run into the same problem, here is how I solved it.
I had the same problem.
To solve it, I imported each font resource to my project.
I'm using Cocoapods with use_frameworks!
. Because frameworks are dynamic they need a bundle resource. FontAwesomeKit doesn't have yet
@ldong Right way to solve it. BTW, could it be solved when use_frameworks!
is set using cocoa pods
Had a similar issue in my another pod. solved by using this
[[NSBundle bundleForClass:[self class]] URLForResource:@"configuration" withExtension:@"plist"]
And this works for use_frameworks!
So I guess this issue can be fixed by this
// FAKFontAwesome.h
+ (UIFont *)iconFontWithSize:(CGFloat)size
{
#ifndef DISABLE_FONTAWESOME_AUTO_REGISTRATION
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self registerIconFontWithURL:[[NSBundle bundleForClass:[self class]] URLForResource:@"FontAwesome" withExtension:@"otf"]];
});
#endif
UIFont *font = [UIFont fontWithName:@"FontAwesome" size:size];
NSAssert(font, @"UIFont object should not be nil, check if the font file is added to the application bundle and you're using the correct font name.");
return font;
}
or use this workaround
[FAKIcon registerIconFontWithURL:[[NSBundle bundleForClass:[FAKFontAwesome class]] URLForResource:@"FontAwesome" withExtension:@"otf"]];
I think this issue can be closed now.
Just checked in last version, it is using bundleForClass
now.
@cincas check: https://github.com/PrideChung/FontAwesomeKit/blob/2.2.0/FontAwesomeKit/FAKIonIcons.m
it's still using [NSBundle mainBundle]
@chenyuan I guess you were trying to say "it is still using [NSBundle mainBundle]
" right?
check out the master branch. I think they havent released the new version number with this fix.
I'm using pod "FontAwesomeKit", :head
as solution atm.
@cincas thanks, your are right, corrected the comment
I've run into this issue as well after switching my project to to use use_frameworks!
. My version of the cocoapod is up to date, is the workaround just to manually register the font file?
Edit: Just tried pointing my podfile to the most recent commit on this repo, as mentioned above. Seems to have solved the problem by including this pull request: https://github.com/PrideChung/FontAwesomeKit/pull/32. When will the pod be updated with this?
@Ziewvater you can use pod "FontAwesomeKit", :head
as a workaround.
master has been updated to use bundleForClass:
instead of mainBundle
@cincas pod "FontAwesomeKit", :head
works for me. Thanks a lot!
pod "FontAwesomeKit", :head
used to work for me. But when I update xcode and cocoapods, it stops working.
OS X Yosemite Xcode 7.2.1 cocoapods 1.0.0.beta.4
pod 'FontAwesomeKit/FontAwesome',
git: 'https://github.com/PrideChung/FontAwesomeKit.git'
NOTE: :head
does not work with the latest version of cocoapods.
2016-02-29 12:53:25.594 App[38801:229238] *** Assertion failure in +[FAKFontAwesome registerIconFontWithURL:], /path/to/App/ios/Pods/FontAwesomeKit/FontAwesomeKit/FAKIcon.m:14
2016-02-29 12:53:25.618 App[38801:229238] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Font file doesn't exist'
@tomoyuki28jp you should be using the following as of cocoapod 1.0, cheers
pod 'FontAwesomeKit/FontAwesome', :git => 'https://github.com/PrideChung/FontAwesomeKit.git'
Solved: It was already available in pods bundle I imported the
FontAwesome.otf
file in my main bundle and it worked.
I'm getting a weird error - looks like the fonts aren't being registered properly? Doing this in my AppDelegate as a workaround as detailed in KnownIssues