Re: Output to the XCode 3.0 console - News
Re: Output to the XCode 3.0 console - News
- Subject: Re: Output to the XCode 3.0 console - News
- From: Lorenzo <email@hidden>
- Date: Thu, 01 Nov 2007 04:18:51 +0100
Hi Kyle,
I mean the main process. After that call, all of my NSLog everywhee in the
code go to the Console application. I paste here the code.
The first NSLog goes to the Xcode console.
The last NSLog goes to the Console application, and all the next NSLog when
my app is running, too.
- (NSString*)GetLocalMacAddress
{
NSLog(@"GetLocalMacAddress");
NSString *commandLine = @"ifconfig en0 | grep ether | cut -d' ' -f 2";
NSArray *args = [NSArray arrayWithObjects:@"-c", commandLine, nil];
NSTask *task = [[NSTask alloc] init];
NSPipe *thePipe = [NSPipe pipe];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:args];
[task setStandardOutput:thePipe];
[task launch];
[task waitUntilExit];
if([task terminationStatus] != noErr){
[task release];
NSLog(@"GetLocalMacAddressUnix: Error from the shell.");
return @"";
}
NSData *dataOut = [[thePipe fileHandleForReading] availableData];
[task release];
if(!dataOut) return @"";
NSMutableString *localMacAddress = [[[NSMutableString alloc]
initWithData:dataOut encoding:NSASCIIStringEncoding] autorelease];
char lastChar = [localMacAddress characterAtIndex:[localMacAddress
length]-1];
if(lastChar == '\r' || lastChar == '\n'){
[localMacAddress
deleteCharactersInRange:NSMakeRange([localMacAddress length]-1, 1)];
}
[localMacAddress replaceOccurrencesOfString:@":" withString:@"."
options:nil range:NSMakeRange(0, [localMacAddress length])];
NSLog(@"localMacAddress %@", [localMacAddress uppercaseString]);
return [localMacAddress uppercaseString];
}
Best Regards
--
Lorenzo
email: email@hidden
> From: Kyle Sluder <email@hidden>
> Date: Thu, 01 Nov 2007 01:23:16 +0000
> To: Lorenzo <email@hidden>
> Cc: email@hidden
> Subject: Re: Output to the XCode 3.0 console - News
>
> Are you referring specifically to NSLog in your main process, or the
> output of the child process you've launched as well? Post some code
> that exhibits the exact behavior you're seeing.
>
> --Kyle Sluder
>
> On 11/1/07, Lorenzo <email@hidden> wrote:
>> After the [task launch]; my application diverges the output to the Console
>> application only and not longer to the XCode 3.0 console, no matter whether
>> running as development or deployment. This never happened on XCode 2.5 (all
>> the NSLog went properly to the XCode console only).
>>
>> ///////////////////// Here I get all the NSLog on the XCode console
>> ///////////////////// and on the Console application too
>> NSString *commandLine = @"ifconfig en0 | grep ether | cut -d' ' -f 2";
>> NSArray *args = [NSArray arrayWithObjects:@"-c", commandLine, nil];
>> NSTask *task = [[NSTask alloc] init];
>> NSPipe *thePipe = [NSPipe pipe];
>>
>> [task setLaunchPath:@"/bin/sh"];
>> [task setArguments:args];
>> [task setStandardOutput:thePipe];
>> [task launch];
>> ///////////////////// Now I get the NSLog on the Console application only
>> [task waitUntilExit];
>>
>>
>> I need to get the NSLog on the XCode console only. How can I fix this?
>> Is it an XCode's 3.0 bug? Or did I miss something?
>>
>>
>> Best Regards
>> --
>> Lorenzo
>> email: email@hidden
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden