Re: Crashing on writing to NSLog?
Re: Crashing on writing to NSLog?
- Subject: Re: Crashing on writing to NSLog?
- From: Manfred Schwind <email@hidden>
- Date: Thu, 22 Feb 2007 23:08:56 +0100
Is it possible that I am crashing my application by writing data to
the Console using NSLog?
[...]
NSLog([[exception name] stringByAppendingString:[exception reason]]);
Note that NSLog takes a format string as first parameter. So you
should never pass strings from other/uncontrolled sources as first
parameter to NSLog - they may contain format specifications and that
may crash your application as you do not provide the expected
parameters for the format.
So you should better do this instead:
NSLog(@"%@", [[exception name] stringByAppendingString:[exception
reason]]);
or this:
NSLog(@"%@%@", [exception name], [exception reason]);
Regards,
Mani
--
http://www.mani.de/
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.
iSale - you sell@eBay.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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