Skip to content

Instantly share code, notes, and snippets.

@chamons
Created July 7, 2016 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamons/e2e409013a449cfbe1f2fbe5547f6554 to your computer and use it in GitHub Desktop.
Save chamons/e2e409013a449cfbe1f2fbe5547f6554 to your computer and use it in GitHub Desktop.
public static class NSLogHelper
{
[DllImport ("/System/Library/Frameworks/Foundation.framework/Foundation")]
extern static void NSLog (IntPtr format, [MarshalAs (UnmanagedType.LPStr)] string s);
public static void NSLog (string format, params object[] args)
{
var fmt = NSString.CreateNative ("%s");
var val = (args == null || args.Length == 0) ? format : string.Format (format, args);
NSLog (fmt, val);
NSString.ReleaseNative (fmt);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment