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 7189097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:13:43+00:00 2026-05-28T19:13:43+00:00

I have a text field bound to a nsmutableablestring. In the action item for

  • 0

I have a text field bound to a nsmutableablestring. In the action item for a button I want to clear this string but it’s throwing an exception saying it’s immutable.

Member variable is

NSMutableString* firstName;

Property for binding to the text field is declared in .h

@property (copy) NSMutableString* firstName;

In the action for the button the following line throws an exception

[firstName setString:@""];

I don’t have any trouble reading the value in firstName to access what is in the text field so the binding appears to be working.

Here is the stack trace

Attempt to mutate immutable object with setString:
2012-01-22 14:48:58.084 testproj[2509:707] (
    0   CoreFoundation                      0x00007fff88233286 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff857bdd5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff882330ba +[NSException raise:format:arguments:] + 106
    3   CoreFoundation                      0x00007fff88233044 +[NSException raise:format:] + 116
    4   CoreFoundation                      0x00007fff882892dd mutateError + 93
    5   testproj                            0x00000001000035c4 -[AppController AddCustomer:] + 388
    6   CoreFoundation                      0x00007fff88222a1d -[NSObject performSelector:withObject:] + 61
    7   AppKit                              0x00007fff8f319710 -[NSApplication sendAction:to:from:] + 139
    8   AppKit                              0x00007fff8f319642 -[NSControl sendAction:to:] + 88
    9   AppKit                              0x00007fff8f31956d -[NSCell _sendActionFrom:] + 137
    10  AppKit                              0x00007fff8f318a30 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2014
    11  AppKit                              0x00007fff8f3988e0 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 489
    12  AppKit                              0x00007fff8f31763a -[NSControl mouseDown:] + 786
    13  AppKit                              0x00007fff8f2e20e0 -[NSWindow sendEvent:] + 6306
    14  AppKit                              0x00007fff8f27a68f -[NSApplication sendEvent:] + 5593
    15  AppKit                              0x00007fff8f210682 -[NSApplication run] + 555
    16  AppKit                              0x00007fff8f48f80c NSApplicationMain + 867
  • 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-28T19:13:44+00:00Added an answer on May 28, 2026 at 7:13 pm

    Are you relying on the synthesized setter? copy returns an immutable copy so you need to define your own setter. See http://vgable.com/blog/2009/03/17/mutable-property-and-copy-gotcha/ for more details

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

Sidebar

Related Questions

I have a jQuery jPicker colorpicker that is bound to an input text field
I have a text field (flash.display.textField) for editing, but the default font does not
I have an input text field, which has a value something by default, but
I have a text input field like text box or text area. I want
I have a text field which is bound with Integer variable, so when user
I have an NSSlider bound to a text field to display the value given
I have setup a Netbeans form with a text-field bound to a bean property.
The idea of this page is, I have a text field which, when you
I have a text field and am looking to have if be valid for
If I have a text field with SWT, how can I get the field

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.