Re: Crash on iOS when encoding an NSAttributedString
Re: Crash on iOS when encoding an NSAttributedString
- Subject: Re: Crash on iOS when encoding an NSAttributedString
- From: Cody Garvin <email@hidden>
- Date: Sun, 19 Jan 2014 11:09:24 -0800
sounds like an attribute can't encode itself. I know CGColorRef doesn't know how to encode itself, which is what CoreText uses to render. If try and pull the string out and serial size the attributes separately, or find a way to serialize CGColorRef. Sorry I'm not much help.
Please excuse mobile typos
> On Jan 19, 2014, at 10:54 AM, Markus Spoettl <email@hidden> wrote:
>
> Hello,
>
> I got a crash log from a user that's mildly puzzling. It happens somewhere deep down CoreText it seems, while encoding an NSAttributedString (whose content I don't know). Any ideas how it can some to this?
>
> My app has a standard UITextView that feeds the model property that is encoded here. There is no processing of the attributed string going on in the App. The UITextView is created dynamically (not loaded from a NIB), it is embedded in a custom UITableViewCell (just in case that influences the way it constructs attributed strings it spits out).
>
> Google turns up some crashes with a similar top end of the call stack, but those happen while drawing the attributed string. Does iOS draw a NSAttributedString in order to object-encode it?
>
> The code that eventually ends up crashing is
>
> - (void)encodeWithCoder:(NSCoder *)encoder
> {
> ....
> [encoder encodeObject:notes forKey:@"notes"];
> ....
> }
>
> Does this ring a bell for anyone?
>
> Regards
> Markus
>
> Hardware Model: iPhone6,2
> Process: MyApp [3818]
> Path: /var/mobile/Applications/9C395437-7BC5-47A8-B4BE-C659F61F5628/MyApp.app/MyApp
> Identifier: com.bla.MyApp
> Version: 162 (1.0)
> Code Type: ARM-64 (Native)
> Parent Process: launchd [1]
>
> Date/Time: 2014-01-19 06:44:51.347 +0000
> OS Version: iOS 7.0.4 (11B554a)
> Report Version: 104
>
> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
> Exception Subtype: KERN_INVALID_ADDRESS at 0x7300786966657250
> Triggered by Thread: 0
>
> Thread 0 Crashed:
> 0 ??? 0x7300786966657250 0 + 8286755708446536272
> 1 CoreText 0x000000018c689bd8 TBaseFont::CalculateFontMetrics(bool) const + 100
> 2 CoreText 0x000000018c699930 TComponentFont::CalculateFontMetrics(bool) const + 52
> 3 CoreText 0x000000018c689a2c TBaseFont::InitFontMetrics() const + 64
> 4 CoreText 0x000000018c70bec8 TBaseFont::GetStrikeMetrics(double, CGAffineTransform const*, bool) const + 96
> 5 CoreText 0x000000018c689774 TFont::InitStrikeMetrics() const + 64
> 6 CoreText 0x000000018c689704 CTFontGetAscent + 120
> 7 GraphicsServices 0x00000001917ffc14 GSFontEnsureExtraData + 256
> 8 GraphicsServices 0x0000000191802940 GSFontGetExtraData + 52
> 9 UIFoundation 0x0000000194c3ee00 -[UIFont isIBTextStyleFont] + 12
> 10 UIFoundation 0x0000000194c3e904 -[UIFont encodeWithCoder:] + 112
> 11 Foundation 0x000000018c9dc210 _encodeObject + 1244
> 12 Foundation 0x000000018c9dd74c -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 468
> 13 Foundation 0x000000018c9dd374 -[NSDictionary(NSDictionary) encodeWithCoder:] + 1024
> 14 Foundation 0x000000018c9dc210 _encodeObject + 1244
> 15 Foundation 0x000000018c9e9a80 -[NSAttributedString encodeWithCoder:] + 252
> 16 Foundation 0x000000018c9dc210 _encodeObject + 1244
> 17 MyApp 0x000000010014bb64 -[Activity encodeWithCoder:] (SRC.m:2319)
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden