Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:52:53+00:00 2026-05-28T13:52:53+00:00

I created a method to generate an attributed string from a normal string. The

  • 0

I created a method to generate an attributed string from a normal string. The attrString value below is non-null and correct in its content.

Upon running my application, the second line fails with an EXC_BAD_ACCESS. Any idea why?

The __bridge_retained call is an iOS 5 requirement afaik. I’ve also tried __bridge but that has no effect, the issue still occurs.

    NSMutableAttributedString *attrString = (NSMutableAttributedString*)[textLayer attributedString];
    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge_retained CFMutableAttributedStringRef)attrString);

UPDATE

If I do:

    NSMutableAttributedString *attrString = (NSMutableAttributedString*)[textLayer attributedString];
    NSLog(@"%@", attrString);
    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge CFMutableAttributedStringRef)attrString);

Then the NSLog line won’t compile; Xcode gives a warning and error stating "Incompatible pointer types passing 'char[3]' to parameter of type 'NSString *'".

So I tried this instead:

    NSLog([attrString description]);

And this gives the following output (I’ve replaced the string contents with <snipped> for privacy):

2012-01-19 06:49:11.307 WritePath[2475:707] <Snipped>
{
CTForegroundColor = "<CGColor 0x281530> [<CGColorSpace 0x22d1a0> (kCGColorSpaceDeviceRGB)] ( 0 0 0 1 )";
NSFont = "<CGFont (0x28f850): ArialMT>";
NSParagraphStyle = "CTParagraphStyle:\nwriting direction = -1, alignment = 3, line break mode = 0, default tab interval = 0\nfirst line head indent = 0, head indent = 0, tail indent = 0\nline height multiple = 0, maximum line height = 0, minimum line height = 0\nline spacing adjustment = 0, paragraph spacing = 0, paragraph spacing before = 0\ntabs:\n<CFArray 0x287b50 [0x3f229630]>{type = immutable, count = 12, values = (\n\t0 : CTTextTab: location = 28, alignment = 0, options = (none)\n\n\t1 : CTTextTab: location = 56, alignment = 0, options = (none)\n\n\t2 : CTTextTab: location = 84, alignment = 0, options = (none)\n\n\t3 : CTTextTab: location = 112, alignment = 0, options = (none)\n\n\t4 : CTTextTab: location = 140, alignment = 0, options = (none)\n\n\t5 : CTTextTab: location = 168, alignment = 0, options = (none)\n\n\t6 : CTTextTab: location = 196, alignment = 0, options = (none)\n\n\t7 : CTTextTab: location = 224, alignment = 0, options = (none)\n\n\t8 : CTTextTab: location = 252, alignment = 0, options = (none)\n\n\t9 : CTTextTab: location = 280, alignment = 0, options = (none)\n\n\t10 : CTTextTab: location = 308, alignment = 0, options = (none)\n\n\t11 : CTTextTab: location = 336, alignment = 0, options = (none)\n\n)}";
}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:52:54+00:00Added an answer on May 28, 2026 at 1:52 pm

    I noticed this in your attributed string dump:

    NSFont = "<CGFont (0x28f850): ArialMT>"
    

    Did you create the attributed string using a CGFontRef as the value for the kCTFontAttributeName key? You must use a CTFontRef, not a CGFontRef. They are different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created the following method for retrieving stored settings from the database: public String
I have Dropdownlist on my page and its selectedindexchanged method created in code behind
We've created a generic method like so: public TReturnType GetValue(string key) { var configurationParameter
I've created a method that generates a new class and adds some methods into
I'm trying to learn about Expression trees, and I've created a method that takes
Given a DataSet, I'm left joining DataTables[1-n] onto DataTable[0]. I have created a method
I created an extension method called HasContentPermission on the System.Security.Principal.IIdentity : namespace System.Security.Principal {
I have created a new method in one of the project's controllers that it
I've created a custom method called checkout in my app. I create an order
I've created an extension method for SqlCommand that allows some additional work before executing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.