Skip to content

Instantly share code, notes, and snippets.

@andreashanft
Created June 14, 2013 16:11
Show Gist options
  • Save andreashanft/5783166 to your computer and use it in GitHub Desktop.
Save andreashanft/5783166 to your computer and use it in GitHub Desktop.
[CocoaPods] Podfile post install hook hack - get rid of those noobish NSLogs in mediocre libs imported by cocoapods. Silences them in release builds and add class and line number info to target that sucker in debug builds
post_install do | installer |
prefix_header = installer.config.project_pods_root + 'Pods-prefix.pch'
text = prefix_header.read + <<-EOS
#if DEBUG
#define NSLog(fmt, ...) NSLog((@"[DEBUG] %s [Line %d] " fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define NSLog(fmt, ...) (void)0
#endif
EOS
prefix_header.open('w') { |file| file.write(text) }
end
@martinstolz
Copy link

Muhaha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment