• 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: About NSString - uppercaseString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About NSString - uppercaseString


  • Subject: Re: About NSString - uppercaseString
  • From: Ondra Cada <email@hidden>
  • Date: Sat, 19 Oct 2002 15:06:35 +0200

On Saturday, October 19, 2002, at 01:09 , Webb wrote:

I think I must call NSString method "canBeConvertedToEncoding" before calling "uppercaseString", such as:

No you don't have to.

NSString* aString = [NSString stringWithContentsOfFile:@"/Users/Webb/test.
dat"];
NSString* aConvertedString = nil;
if ( [aString canBeConvertedToEncoding:NSASCIIStringEncoding] ) {
aConvertedString = [aString uppercaseString];
} else {
aConvertedString = @"";
}
...

For some reasons the data of string may come from a image file. If I call "uppercaseString" directly without calling "canBeConvertedToEncoding", I will meet an error like this:

*** malloc[2283]: error for object 0x14ca220: Incorrect check sum for freed object - object was probably modified after beeing freed; break at szone_error

The best bet is you don't retain the string correctly. @"", being a constant, does not ever free.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >About NSString - uppercaseString (From: Webb <email@hidden>)

  • Prev by Date: Re: Directory Enumeration in Cocoa
  • Next by Date: Re: Setting an NSDate with natural language string
  • Previous by thread: About NSString - uppercaseString
  • Next by thread: Setting an NSDate with natural language string
  • Index(es):
    • Date
    • Thread