I am calling sizeWithFont on a background thread, this sizeWithFont is located on the drawRect, which is called on an NSOperationQueue on a background thread. I occasionally had random crashes on the sizeWithFont. I've been googling around and it seems some say this is an issue on apple. What's a better way to fix this then?
It is said in the documentation the following as of iOS 4:
Drawing to a graphics context in UIKit is now thread-safe. Specifically: The routines used to access and manipulate the graphics context can now correctly handle contexts residing on different threads. String and image drawing is now thread-safe. Using color and font objects in multiple threads is now safe to do.
I have something like this:
titleSize = [storyTitleString sizeWithFont:[UIFont fontWithName:kProximaNovaBold size:15] constrainedToSize:CGSizeMake(200, kCellMaximumTitleHeight) lineBreakMode:UILineBreakModeWordWrap];
in my drawRect. You can replace storyTitleString with any string you want. And I also using this library to perform drawing in background thread.