For some reason code like
segfaults on lion. Others have noted that this only occurs when the data contains bytes with the high bit set. This smells like something trying to interpret the string in some encoding when the string is in fact arbitrary binary data.
I’d love to use MacRuby instead of RubyCocoa, but unfortunately MacRuby doesn’t seem to be able to handle Active Record at the moment, so I can’t use it (yet). I haven’t had time to delve properly into how RubyCocoa converts between ruby and Objective-C objects but I was able to hack around by using ruby inline
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Then you can use
CFDataGenerator.from_string to convert ruby strings into nsdata instances. Remember to release the instance when you’re done!