Re: string help
Re: string help
- Subject: Re: string help
- From: Gammah Radiation <email@hidden>
- Date: Wed, 7 Sep 2005 20:57:41 -0500
Maybe in the way you're copying that string in -setCommandString ?
This is what I have, in a program directly from the the RaiseMan app in
Cocoa Programming For Mac:
- (void)setPersonName:(NSString *)aName
{
aName = [aName copy];
[personName release];
personName = aName;
}
On 9/7/05, Bob Sabiston <email@hidden> wrote:
>
> Hello,
>
> Well, I finally got my table of data to display! It's great.
> Now I am trying to make it a little fancier, and I am running into
> trouble with strings.
>
> From my Carbon app, I am calling a function in the Cocoa bundle,
> trying to set a string value:
>
> OSStatus setCommandString(CFStringRef message) {
> NSAutoreleasePool *localPool;
>
> localPool = [[NSAutoreleasePool alloc] init];
> [[Controller sharedController] setCommandString:(NSString *)
> message];
> [localPool release];
> return noErr;
> }
>
> Within my Controller object, I have commandString defined like this:
>
> @interface Controller : NSObject {
> ...
> NSMutableString *commandString;
>
> ...
> }
>
> and here is the function I use to change the value.
>
> - (void)setCommandString:(NSString *)text {
> if (text)
> [commandString setString:text];
> else [commandString setString:@"unknown"];
> }
>
> Somewhere along the line, it is crashing. I believe that it's
> happening with the call to setCommandString, though I can't see
> what's wrong. Should the code above work, assuming the initial
> message is a valid string?
>
> Thanks
> Bob
>
> _______________________________________________
> 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
>
_______________________________________________
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: | |
| >string help (From: Bob Sabiston <email@hidden>) |