Open vincilbishop opened 8 years ago
I'm having this same issue. Wasn't able to fix it though.
+1 on [UIFont familyNames], I call once in my AppDelegate and have no more issues. Bizarre.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//iOS 10 Random crash fix..........
[UIFont familyNames];
return YES;
}
In order to fix this with a pod install using frameworks, the FontAwesome stuff is no longer in the mainBundle so the calls need to change from:
dispatch_once(&onceToken, ^{ [self registerIconFontWithURL: [[NSBundle mainBundle] URLForResource:@"zocial-regular-webfont" withExtension:@"ttf"]]; });
to:
dispatch_once(&onceToken, ^{ [self registerIconFontWithURL: [[NSBundle bundleForClass:[self class]] URLForResource:@"zocial-regular-webfont" withExtension:@"ttf"]]; });
FAKIcon.m:16: registerIconFontWithURL: CGFontRef newFont = CGFontCreateWithDataProvider(fontDataProvider); Crashes with little explanation. Was working fine in 9.3.2, but after upgrading to iOS 10, both older versions, and the new 2.2.0 crash on this line. The code seems to have been unchanged.
For some reason, I was able to follow the instructions in this SO post:
http://stackoverflow.com/questions/24900979/cgfontcreatewithdataprovider-hangs-in-airplane-mode
and call [UIFont familyNames]; before the registerIconFontWithURL: method was called, and the problem was solved. Weird.