Re: error strings in NSPropertyListSerialization
Re: error strings in NSPropertyListSerialization
- Subject: Re: error strings in NSPropertyListSerialization
- From: "Adam R. Maxwell" <email@hidden>
- Date: Thu, 27 Mar 2008 18:52:10 -0700
On Mar 27, 2008, at 6:10 PM, B.J. Buchalter wrote:
In the docs for [NSPropertyListSerialization
propertyListFromData:mutabilityOption:format:errorDescription:] it
has the following comment:
Special Considerations
----------------------
Strings returned in errorString needed to be released by the caller
prior to Mac OS X version 10.5. In Mac OS X version 10.5 and later,
strings returned inerrorString are memory managed for the caller.
I think the API docs are wrong here. From the Foundation release
notes <http://developer.apple.com/releasenotes/Cocoa/Foundation.html>:
NSPropertyListSerialization (Updated since WWDC 2007)
A previous release note in the Leopard Foundation release notes said
that a leak has been fixed in the two NSPropertyListSerialization
methods that return an NSString * error description by reference.
This fix has been reverted, and will never be done. As stated in the
documentation for those methods, and as was true in 10.4 and earlier,
it is the client's responsibility to release that string (if either
method returns nil) in 10.5 and beyond as well.
I understand this to mean that prior to 10.5, we needed to do a
[errorString release]. But I am very unclear what this means
practically for the code that I am writing today.
You still need to (auto)release the returned error string if
NSPropertyListSerialization returns nil.
--
adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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