• 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 Bundle] NSString To JavaScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >[Cocoa Bundle] NSString To JavaScript (From: محمد الركيان <email@hidden>)

  • Prev by Date: Re: Compile error
  • Next by Date: Re: [Cocoa Bundle] NSString To JavaScript
  • Previous by thread: [Cocoa Bundle] NSString To JavaScript
  • Next by thread: Re: [Cocoa Bundle] NSString To JavaScript
  • Index(es):
    • Date
    • Thread