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

  • Home
  • SEARCH
  • 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 6612623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:07:13+00:00 2026-05-25T20:07:13+00:00

My second day working with Cocoa. I’ve got an NSTextView set up, its attributed

  • 0

My second day working with Cocoa. I’ve got an NSTextView set up, its attributed string is bound to an NSArrayController (I’m using Core Data):

controller key: selection
model key path: myString

I’ve read that an NSTextView needs an NSAttributedString, which is why it’s throwing an exception when trying to set the value of the attribute.

NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "myString"; desired type = NSString; given type = NSConcreteAttributedString; 

Any ideas how I can get my managedObject’s NSString attribute to be shown in an NSTextView?

  • 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-25T20:07:14+00:00Added an answer on May 25, 2026 at 8:07 pm

    You can use a NSValueTransformer subclass to go back and forth

    @interface XXStringTransformer: NSValueTransformer {}
    @end
    
    @implementation XXStringTransformer
    + (Class)transformedValueClass 
    {   
        return [NSAttributedString class]; 
    }
    + (BOOL)allowsReverseTransformation 
    { 
        return YES; 
    }
    - (id)transformedValue:(id)value 
    {
        return (value == nil) ? nil : [[[NSAttributedString alloc] initWithString:value] autorelease];
    }
    
    - (id)reverseTransformedValue:(id)value
    {
        return (value == nil) ? nil : [[(NSAttributedString *)value string] copy];
    }
    
    @end
    

    Caveat Emptor – This might be upside down and the reverser might leak. I just made it now but it should point you in the right direction. Let me know and ill correct the answer if its wrong.

    You can type the class name XXStringTransformer into the binding panel or do it programmatically.

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

Sidebar

Related Questions

I'm in my second day of learning Objective-C, Cocoa and IB. This is probably
I've been trying to get this working correctly all day, its nearly complete just
the output should process the first date as day and second as night. I've
In SQL Server, how do I floor a DATETIME to the second/minute/hour/day/year? Let's say
(second question today - must be a bad day) I have a dataframe with
Given a date/time as an array of (year, month, day, hour, minute, second), how
the second function isnt working? $('.edit_hover').live('hover', function(e){ $(this).stop(); var half_width = ($(this).css('width').slice(0, -2))/2; var
I'm quite new to Mac OS X development(just my second day). Did a couple
Good day everybody. I've doing a bit of training at working with Flex and
I have been working on getting a python CGI script to work all day,

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.