Actually on Leopard you should be able to store an NSValue as an attribute, simply by using an attribute of type Transformable, and setting the Value Transformer Name to NSUnarchiveFromData.

I just tried it though, and it seems like there is a bug which prevents it from working. Basically it seems like any custom value transformer you set for a Transformable attribute is simply ignored, and it still just uses the default transformer, which tries to use a KeyedArchiver and KeyedUnarchiver. I even tried creating my own NSValueTransformer subclass and setting it as the value transformer for a Transformable attribute. I can see that its init method gets called, but none of its other methods ever get called when saving a document. I just filed a bug with Apple about this, radar 5851442.


On Apr 3, 2008, at 5:31 AM, Daniel Thorpe wrote:

Thanks for the feedback on this.

I have gone with using a ...AsString attribute and using NSRectFromString. Seems to work okay, although I've got no idea if it's the most efficient method. I think Core Data seems a little limited in that you can't store an NSValue object as an attribute, I'd have thought that would be obvious, as we use that class to store structs in collection objects....

I hadn't considered localisation issues, but on my machine it stores the data like so in an XML store:

<attribute name="extentasstring" type="string">{{368, 260}, {2, 5}}</attribute> <attribute name="centreofmassasstring" type="string">{368.75, 263.25}</attribute>

which seems to make sense.

Cheers
Dan

On 2 Apr 2008, at 18:33, Uli Kusterer wrote:

On 02.04.2008, at 18:58, Thomas Engelmeier wrote:
That potentially means opening Pandoras can to localisation issues. Any time you go that route, be sure to check that code with switching decimal separators.


Potentially? Maybe. But I just tried it, and for me NSStringFromRect() never uses localized separators. So, since it always gives and takes periods as the decimal separator, I see no problem. Do you have a particular test case where it behaves differently?

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/danthorpe %40gmail.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/adam%40thejenkins.org

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to