• 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
Cocoa shell works great from PB, crashes as standalone.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa shell works great from PB, crashes as standalone.


  • Subject: Cocoa shell works great from PB, crashes as standalone.
  • From: Chilton Webb <email@hidden>
  • Date: Tue, 23 Oct 2001 12:04:32 -0500

Hi,

OK, moving right along here, I thought I'd just wrap my server app up in a Cocoa shell and run it from there. A few minutes in PB and I had it working. But when time came to dump this on the world, ie move it to the server box, the app crashes on launch. I've verified that this happens from the Finder as well, even on the development machine.

I've narrowed it down to the call to my tool (the server itself). If I comment out the line that launches it, the app works great. If I leave it in, it crashes, but only from a double-click in the Finder.

Here's the code. The distinct lack of error checking will be remedied shortly, but in the interim, why is this crashing?

-Chilton


/// code follows ////

#import "ServerStatus.h"

@implementation ServerStatus


- (BOOL)applicationShouldTerminateAfterLastWindowClosed:
(NSApplication *)theApplication {
return YES;
}


- (void)awakeFromNib {
[window makeKeyAndOrderFront:nil];
[self StartServer];
}


- (IBAction)ToggleOff:(id)sender
{
[gameserver terminate];
}

- (IBAction)ToggleOn:(id)sender
{
[self StartServer];
}

- (void)StartServer {
[StartButton setEnabled:NO];
[StopButton setEnabled:YES];
[statusbox setStringValue:@"Server is running. Click 'Stop' to stop it."];
gameserver=[[NSTask alloc] init];
[gameserver setLaunchPath:@"./TCPServerAlpha"];
[gameserver launch]; //<-- if I comment this out, it works.
}

- (id)init {
self = [super init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(serverDown:)
name:NSTaskDidTerminateNotification
object:nil];

gameserver = nil;
return self;
}



- (void)serverDown:(NSNotification *)aNotification {
[statusbox setStringValue:@"Server is stopped. Click 'Start' to make it run."];
[StartButton setEnabled:YES];
[StopButton setEnabled:NO];

[gameserver release];
gameserver=nil;
}


@end


  • Follow-Ups:
    • Re: Cocoa shell works great from PB, crashes as standalone.
      • From: Ondra Cada <email@hidden>
    • Re: Cocoa shell works great from PB, crashes as standalone.
      • From: Brendan Younger <email@hidden>
    • Re: Cocoa shell works great from PB, crashes as standalone.
      • From: email@hidden
  • Prev by Date: Re: Instantiating window from nib
  • Next by Date: Re: Selecting multiple cells in a NSMatrix
  • Previous by thread: Re: Selecting multiple cells in a NSMatrix
  • Next by thread: Re: Cocoa shell works great from PB, crashes as standalone.
  • Index(es):
    • Date
    • Thread