Note that there are some explanatory texts on larger screens.

plurals
  1. POHow is this error possible: Unrecognized Selected (screenFontWithRenderingMode) in iOS?
    primarykey
    data
    text
    <p>This one doesn't make any sense to me. My app crashes with the following error:</p> <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType screenFontWithRenderingMode:]: unrecognized selector sent to instance 0x209bb200' </code></pre> <p>This is an iOS app. From what I can see, screenFontWithRenderingMode is an NSFont method for Mac OS X, not iOS. So how can this error even be occurring? </p> <p>I am building the app with the newly released Xcode 5. The app will support iOS version 6.1 and 7.0 (and higher). This error ONLY occurs when running the app on a 6.1 device (and simulator).</p> <p>EDIT:</p> <p>I wasn't able to produce the crash log by running the app in debug mode. By creating an Ad Hoc build I was able to load the app, run it, crash, and retrieve the crash log:</p> <pre><code>0 CoreFoundation 0x3220a29e __exceptionPreprocess + 158 1 libobjc.A.dylib 0x3a06e97a objc_exception_throw + 26 2 CoreFoundation 0x3220de02 -[NSObject(NSObject) doesNotRecognizeSelector:] + 166 3 CoreFoundation 0x3220c52c ___forwarding___ + 388 4 CoreFoundation 0x32163f64 __forwarding_prep_0___ + 20 5 UIFoundation 0x37da15c8 +[NSStringDrawingTextStorage _fastDrawString:attributes:length:inRect:graphicsContext:baselineRendering:usesFontLeading:usesScreenFont:typesetterBehavior:paragraphStyle:lineBreakMode:boundingRect:padding:scrollable:baselineOffset:] + 344 6 UIFoundation 0x37da0184 -[NSAttributedString(NSExtendedStringDrawing) _doBoundingRectWithSize:options:context:baselineOffset:] + 676 7 UIFoundation 0x37d9fc8c -[NSAttributedString(NSExtendedStringDrawing) boundingRectWithSize:options:context:] + 2492 </code></pre> <p>I was able to track down the offending line:</p> <pre><code>CGRect rect = [[MLFeedCell attributedBodyForItem:item].attributedString boundingRectWithSize:CGSizeMake(labelWidth, 10000) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil]; </code></pre> <p>I'm not sure what's wrong with this call.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload