XCode Ruby脚本输出仅在出现错误时可见

XCode Ruby脚本输出仅在出现错误时可见,xcode,ios5,Xcode,Ios5,我有ruby脚本构建阶段来增加版本号并记录构建日期。 它们工作得很好,但是我想在LogNavigator中将新值回显到构建日志中。 如果脚本中有错误,puts和print命令会回显它们的值,但我希望在代码运行时看到它们 以下是脚本: # add build date to Info.plist the_date=`date` print "date: "+the_date puts "fooooooooooooo" x2="/usr/libexec/PlistBuddy -c \"Set :B

我有ruby脚本构建阶段来增加版本号并记录构建日期。 它们工作得很好,但是我想在LogNavigator中将新值回显到构建日志中。 如果脚本中有错误,puts和print命令会回显它们的值,但我希望在代码运行时看到它们

以下是脚本:

# add build date to Info.plist
the_date=`date`
print "date: "+the_date
puts "fooooooooooooo"

x2="/usr/libexec/PlistBuddy -c \"Set :BuildDateString " + the_date+"\" " + ENV['TARGET_BUILD_DIR'] +"/"+ ENV['INFOPLIST_PATH']
exec(x2)
我在输出中看不到“date:”,也看不到“fooooo”,除非有错误。

您需要输出到。在Ruby中,您可以使用
warn
来实现这一点。例如:

the_date=`date`
warn "date: "+the_date
warn "fooooooooooooo"
…
在生成日志中生成以下输出:


谢谢,效果很好。它解决了这个问题,但我仍然不清楚为什么在以前版本的SDK中可以这样做。@Rayfleck这可能是一个回归错误,也可能是一个实际的更改。由于苹果没有提供可靠的变更记录,如果你认为应该恢复这种行为,你可以申请雷达。