Re: [Cocoa Bundle] NSString To JavaScript
Re: [Cocoa Bundle] NSString To JavaScript
- Subject: Re: [Cocoa Bundle] NSString To JavaScript
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 8 Apr 2007 10:47:21 -0700
Hi. Perhaps you need to use a standard accessor:
- (void)setCityName:(NSString *)vCityName {
if (vCityName != CityName) {
[CityName release];
[vCityName retain];
}
}
Also note a couple of other things...
In Objective-C, 'get' methods are generally not used for standard
accessors. Just use 'cityName' instead of 'getCityName'--also, the
CityName variable should be lower-case, as variables in Objective-C
are supposed to start with a lower-case letter (classes start with an
upper-case letter).
Hope this helps,
Andrew
On Apr 8, 2007, at 9:08 AM, محمد الركيان wrote:
Hi...
See this JavaScript Code:
PT.setCityName("US");
document.getElementById("helloText").innerHTML = PT.getCityName();
When I try to set value in PT Class from JavaScript, then I try to
get it back (as what you see above), some time the widget CRASH and
some time getCityName function return "helloText" !!!!
This happen Only with string, I have other SETs and GETs functions
that handle int and doule, and they are working very good .
this is my code in "Cocoa Bundle":
...
NSString* CityName;
- (void) setCityName:(NSString*) vCityName
{
CityName = vCityName;
}
- (NSString*) getCityName
{
return CityName;
}
...
maybe the problem in pointers ?!!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40ucla.edu
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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