Sharing an attributed string with 3rd party extensions causes a crash.
| Originator: | stuartbreckenridge1 | ||
| Number: | rdar://19967833 | Date Originated: | 26-Feb-15 |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | |
| Classification: | Crash | Reproducible: | Yes |
@IBAction func shareAString(sender: AnyObject) {
let s:NSString = "This string needs to be shared."
var attributedString = NSMutableAttributedString(string: s as String)
var attributedRange = s.rangeOfString("needs") // get the range
attributedString.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(12.0), range: attributedRange) // add an attribute
var activityViewController = UIActivityViewController(activityItems: [attributedString], applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivityTypeAddToReadingList,UIActivityTypeAssignToContact, UIActivityTypePostToFlickr, UIActivityTypePostToVimeo, UIActivityTypeSaveToCameraRoll]
self.presentViewController(activityViewController, animated: true, completion: nil)
}
This code will cause the host app to crash if the attributed string is shared to a 3rd party extension. Mail/Twitter/etc, work fine.
Sharing a non-attributed string to 3rd party extensions works fine.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!