I draw some image in background. Sometimes my app crashes with strange error:
function signature specialization < Arg[0] = Owned To Guaranteed> of MyApp.
I checked all crashes, and I get all of them on methods that do not use context. One of them draw text. How can I specify context to draw text?
UIGraphicsBeginImageContextWithOptions(size, false, 1.0)
let ctx = UIGraphicsGetCurrentContext()
// some code
str.drawInRect(CGRectMake(floor(10 * scaleFactor), yOffset, size.width, floor(60 * scaleFactor)), withAttributes: textFontAttributes)
// code
let img = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
Edit
I do not found any method to draw text in specific context. I use UIGraphicsPushContext(ctx)
before draw text and UIGraphicsPopContext()
after. https://stackoverflow.com/a/10402637/820795