Closed iamcam closed 5 years ago
When setting an attributed placeholder in iOS13 b5, a crash occurs at dispatch_once in UITextView+Placeholder.m
dispatch_once
+ (UIColor *)defaultPlaceholderColor { static UIColor *color = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ UITextField *textField = [[UITextField alloc] init]; textField.placeholder = @" "; color = [textField valueForKeyPath:@"_placeholderLabel.textColor"]; }); return color; }
For example, in our Swift code,
let attributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: font, NSAttributedString.Key.kern: kern, NSAttributedString.Key.foregroundColor: Style.placeholderColor] textView.attributedPlaceholder = NSAttributedString(string: "Description", attributes: attributes)
Duplicate of https://github.com/devxoul/UITextView-Placeholder/issues/61
Fixed in #64
When setting an attributed placeholder in iOS13 b5, a crash occurs at
dispatch_once
in UITextView+Placeholder.mFor example, in our Swift code,