• 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: Why won't compile
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why won't compile


  • Subject: Re: Why won't compile
  • From: Shawn Erickson <email@hidden>
  • Date: Sun, 08 Jan 2006 10:03:18 -0800


On Jan 8, 2006, at 9:53 AM, Mike Abdullah wrote:

However, the compiler is complaining about the line I have marked in bold. Is it something to do with the whole switch statement? I can get it to work fine outside of the switch statement, but to me this seemed the best way of organising the task.

Any ideas?

Looks like you or the list converted things to plain text so we see no bold line. Also it is always helpful to list exactly what the compiler is reporting.


I will guess it is possibly complaining about your defining of "theAlert" inside of the case statements? If so consider making your case statement blocks of code, in other words...

case 1:
	{
			// Mail is not running
			NSAlert *theAlert = [NSAlert alertWithMessageText: @"foo"
												defaultButton: @"Try Again"
											  alternateButton: @"Cancel"
												  otherButton: nil
									informativeTextWithFormat: @"more foo"];
			if ([theAlert runModal] == NSAlertDefaultReturn) {
				[self newDocument: sender];
			}
			else {
				return;
			}
	}
	break;

Personally I would put any of the NSAlert code in your case statement since case 1 and case 2 seem to be the exact same code with only informative text differing. So why not just have you case statement setup a variable that points at the informative text to use and then just have you alert code exist once.

-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Why won't compile (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Why won't compile
  • Next by Date: Propagate build settings to source files?
  • Previous by thread: Why won't compile
  • Next by thread: Propagate build settings to source files?
  • Index(es):
    • Date
    • Thread