I have this code:
UIGraphicsBeginImageContextWithOptions(CGSizeMake(100, 100), NO, 0);
UIFont* font = [UIFont systemFontOfSize:12.0f];
NSDictionary* attributes = @{ NSFontAttributeName: font };
[@"hello" drawInRect:CGRectMake(0, 0, 100, 100) withAttributes:attributes];
UIGraphicsEndImageContext();
It crashes in drawInRect with
-[__NSDictionaryI font]: unrecognized selector sent to instance 0xcb77be0
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI font]: unrecognized selector sent to instance 0xcb77be0'
It works fine if I use deprecated
[@"hello" drawInRect:CGRectMake(0, 0, 100, 100) withFont:font];
What am I doing wrong?