On 3 Nov 2012, at 22:42, Kyle Sluder <k...@ksluder.com> wrote:

> On Nov 2, 2012, at 10:18 PM, "Gerriet M. Denkmann" <gerr...@mdenkmann.de> 
> wrote:
> 
>> 
>> On 3 Nov 2012, at 00:35, Kyle Sluder <k...@ksluder.com> wrote:
>> 
>>> If this is just for debugging purposes, you could swizzle -[NSArray
>>> description] and -[NSDictionary description].
>> 
>> I tried a Category for NSArray like:
> 
> You must never use a category to replace an existing method implementation. 
> Swizzling is the only approach that will work.
> 
>> 
>> Now this:
>>      NSLog(@" Bad Array: %@", array);
>>      NSLog(@" Good Array with description: %@", [array description]);
>> prints:
>> 2012-11-03 12:04:14.548 Writing[84446:303]  Bad Array: (
>>     "\U0e01\U0e38\U0e0d\U0e41\U0e08",
>>     "\U0e04\U0e38\U0e13\U0e04\U0e48\U0e32"
>> )
>> 2012-11-03 12:04:14.548 Writing[84446:303]  Good Array with description: 
>> (
>>      กุญแจ
>>      คุณค่า
>> )
>> 
>>  Is there a way to make the first NSLog work?
>> I seem to remember that it calls something like debuggingDescription, which, 
>> if not overridden calls description.
> 
> Yeah, try sizzling -debugDescription too. And perhaps -debugDictionary 
> (though that might be an Omni-ism).
> 
>> 
>> I have no experience with swizzling.
> 
> Luckily, the term is easily Googleable.

You have convinced me. Next thing on my list is to learn to swizzle like a pro 
(isn't there some famous movie character who likes his alcoholic mix drinks 
stirred with a swizzle stick and not shaken (or is it the other way round?) ?).

Kind regards

Gerriet.


_______________________________________________

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

This email sent to arch...@mail-archive.com

Reply via email to