• 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: Cocoa Programming iPing exercise
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Programming iPing exercise


  • Subject: Re: Cocoa Programming iPing exercise
  • From: Joe Keenan <email@hidden>
  • Date: Thu, 2 Oct 2008 09:20:44 -0400


On Oct 1, 2008, at 1:25 PM, Shawn Protsman wrote:


Here is the project code for the startStopPing method (the relevant part that I think I should change) of iPing:


	task = [[NSTask alloc] init];
	[task setLaunchPath:@"/sbin/ping"];
	NSArray *args = [NSArray arrayWithObjects:@"-c10",
					 [hostField stringValue], nil];
	[task setArguments:args];

Perhaps stupidly, I thought I could just swap out setLaunchPath and then change NSArray:

	task = [[NSTask alloc] init];
	[task setLaunchPath:@"/usr/local/bin/keyreq"];
	NSArray *args = [NSArray arrayWithObject:[hostField stringValue]];
	[task setArguments:args];

'Build and Go' compiles clean but upon entering a number, like 1 in hostField, and then clicking 'Start' results in the 'Debugger Console' going to gdb. With the above modification, I can return setLaunchPath to /sbin/ping and the program works fine.

You forgot the nil argument at the end of the array. Try:

NSArray *args = [NSArray arrayWithObjects:[hostField stringValue], nil];

joe

_______________________________________________

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


  • Follow-Ups:
    • Re: Cocoa Programming iPing exercise
      • From: "Sherm Pendley" <email@hidden>
References: 
 >Cocoa Programming iPing exercise (From: Shawn Protsman <email@hidden>)

  • Prev by Date: Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • Next by Date: Re: Core Data: Copying and pasting chained entities (Renaud C?roce)
  • Previous by thread: Re: Cocoa Programming iPing exercise
  • Next by thread: Re: Cocoa Programming iPing exercise
  • Index(es):
    • Date
    • Thread