toast-notifications-ios
toast-notifications-ios copied to clipboard
sizeWithFont:constrainedToSize:' is deprecated
/iToast.m:74:26: 'sizeWithFont:constrainedToSize:' is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:
Please fix, thank you Roberto
Based on an answer over at StackOverflow, I replaced line 74 with the following:
NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
nil];
CGSize textSize = [text boundingRectWithSize:CGSizeMake(280, 60)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:attributesDict
I'll submit a pull request for this, though this would make the code require iOS 7. The README doesn't specify what version(s) of iOS are supported, but for the sake of iOS 6, I'll add a respondsToSelector:
call.
Actually, you'll still get the warning even with the respondsToSelector:
, so I'm not going to bother with a PR. Either:
- Support iOS 6, and iOS 7 devs deal with warning, or
- Only support iOS 7, and I'm not sure @ecstasy2 wants to do that.