Skip to content

Instantly share code, notes, and snippets.

@vincent284
Created December 22, 2016 09:35
Show Gist options
  • Save vincent284/d285be8efddf6fe972c833bd66bc8fc6 to your computer and use it in GitHub Desktop.
Save vincent284/d285be8efddf6fe972c833bd66bc8fc6 to your computer and use it in GitHub Desktop.
[Cocoapods] Disable NSLog in pods
# Only allow NSLog in DEBUG build, for all Pods
# Referenced from https://gist.github.com/krzyzanowskim/7690635
# Pods-environment.h is no longer supported
post_install do | installer |
Dir.glob("#{installer.sandbox.target_support_files_root}/**/*.pch") do |item|
open(item, "a") do |file|
print "[post_install] Updating #{item}\n"
file.puts <<EOF
// Disable logs
#ifndef DEBUG
#define NSLog(...)
#endif
EOF
end
end
end
@bpoplauschi
Copy link

This still works very nice. Thanks @vincent284

@LuanSiHo
Copy link

This works. Thanks a lot @vincent284

@Patresko
Copy link

Patresko commented Jul 15, 2022

Does not work on version 1.11.3

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