• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: error details in a NSAlert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error details in a NSAlert


  • Subject: Re: error details in a NSAlert
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 05 Apr 2014 18:42:50 -0700

On Apr 5, 2014, at 18:19 , Daniel Luis dos Santos <email@hidden> wrote:

> I want to include the error details and for that I was setting the informativeText field but it doesn’t show up unless its a string literal. I need it to be a variable value.

I don’t know what you mean here. The question of whether it’s a string literal is irrelevant, since the string is passed as a parameter to a NSAlert method, regardless of origin. Can you show code?

> I also tried setting an accessory view but nothing is showed.
>
> The code that uses the accessory view is below.
>
>        NSTextView *accessory = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,200,15)];
>        NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
>        NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
>        [accessory insertText: informativeText];
>        [accessory setEditable:NO];
>        [accessory setDrawsBackground:NO];
>
>        NSAlert* errorAlert = [NSAlert alertWithMessageText:NSLocalizedStringFromTable(@"The user data is not valid. Correct it and try again", @"AccountInfoTab", @"The user data is not valid. Correct it and try again") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat: @""];
>        [errorAlert setAccessoryView: accessory];
>        [errorAlert runModal];

Don’t use this method. The documentation describes it as a “compatibility” method, and so I wouldn’t assume that it behaves exactly as the recommended technique — which is to create a NSAlert object first, then to set the various properties.

Or, since you’ve tried 2 ways to display the contents of your ‘informativeText’ variable and failed, this might be evidence that it doesn’t contain the string you think it should contain.

_______________________________________________

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


References: 
 >error details in a NSAlert (From: Daniel Luis dos Santos <email@hidden>)

  • Prev by Date: error details in a NSAlert
  • Next by Date: Best approach for custom button using layers?
  • Previous by thread: error details in a NSAlert
  • Next by thread: Re: error details in a NSAlert
  • Index(es):
    • Date
    • Thread