Pixate / pixate-freestyle-ios

Pixate Freestyle for iOS
Apache License 2.0
849 stars 134 forks source link

iOS8 Custom Fonts Crash #148

Open alvinpb opened 9 years ago

alvinpb commented 9 years ago

Having crashing issues with iOS8. Stacktrace below - this occurs when I navigate to a UITableView. Issue looks to be related to custom header fonts.

I am using a global CSS style to setup fonts through-out the app. - :not(button) > label { font-family: "PT Sans"; }

Removing this line - I don't get the crash. Looks to be a issue with pixate and UITableViewHeader labels in iOS8.

Refer to here - http://openradar.io/17623734

2014-09-03 12:23:06.255 Pocketbook[11793:782513] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'scaledValueForValue: called on a font that doesn't have a text style set' 
*** First throw call stack: 
( 
0 CoreFoundation 0x04bcfdf6 __exceptionPreprocess + 182 
1 libobjc.A.dylib 0x04870837 objc_exception_throw + 44 
2 CoreFoundation 0x04bcfc8a +[NSException raise:format:arguments:] + 138 
3 Foundation 0x01e683e0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118 
4 UIFoundation 0x09446fe8 -[UIFont _scaledValueForValue:] + 263 
5 UIKit 0x036d0ecc -[UITableViewHeaderFooterView _labelFrame] + 1639 
6 UIKit 0x036d3a22 -[UITableViewHeaderFooterView layoutSubviews] + 264 
7 UIKit 0x02fcfc98 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608 
8 libobjc.A.dylib 0x04883771 -[NSObject performSelector:withObject:] + 70 
9 QuartzCore 0x02ce65df -[CALayer layoutSublayers] + 152 
10 QuartzCore 0x02cda465 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397 
11 QuartzCore 0x02cda2c0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 
12 QuartzCore 0x02c38a8e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284 
13 QuartzCore 0x02c39e54 _ZN2CA11Transaction6commitEv + 392 
14 QuartzCore 0x02cff889 +[CATransaction flush] + 52 
15 UIKit 0x02f4163f _UIApplicationHandleEventQueue + 2244 
16 CoreFoundation 0x04af37bf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
17 CoreFoundation 0x04ae92cd __CFRunLoopDoSources0 + 253 
18 CoreFoundation 0x04ae8828 __CFRunLoopRun + 952 
19 CoreFoundation 0x04ae81ab CFRunLoopRunSpecific + 443 
20 CoreFoundation 0x04ae7fdb CFRunLoopRunInMode + 123 
21 GraphicsServices 0x063da24f GSEventRunModal + 192 
22 GraphicsServices 0x063da08c GSEventRun + 104 
23 UIKit 0x02f45386 UIApplicationMain + 1526 
24 Pocketbook 0x000b9207 main + 167 
25 libdyld.dylib 0x05185ac9 start + 1 
26 ??? 0x00000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
alvinpb commented 9 years ago

For anyone with this issue - can get around it with this.

- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
    if([view isKindOfClass:[UITableViewHeaderFooterView class]]){
        UITableViewHeaderFooterView *sectionHeaderView = (UITableViewHeaderFooterView *) view;
        sectionHeaderView.textLabel.styleMode = PXStylingNone;
    }
}
cliftonlabrum commented 9 years ago

Same issue here. I'm getting around it by commenting out my style declaration in my CSS. 😕

Hopefully a fix comes from Apple soon.

vguerci commented 9 years ago

Looks like building Pixate against iOS7.1 solves this one for me. I understand this is not a solution for everyone, but might help some people

cliftonlabrum commented 9 years ago

Yes, this is an iOS 8 issue.

On Sep 29, 2014, at 01:50, Vincent Guerci notifications@github.com wrote:

Looks like building Pixate against iOS7.1 solves this one for me. I understand this is not a solution for everyone, but might help some people

— Reply to this email directly or view it on GitHub.

zhigang1992 commented 9 years ago

generally, don't use tag like Label, View etc. Only stick to custom class should be fine.

cliftonlabrum commented 9 years ago

You can probably close this issue since this is an iOS problem, not a Pixate one. Using a custom font without Pixate causes the same error on iOS 8.0 and 8.0.2. Since Apple has since fixed this problem, hopefully this is (mostly) behind us.