![](/style/images/good.png)
![](/style/images/bad.png)
Xcode 使用技巧
source link: http://douxinchun.github.io/blog/20180918/tips-of-xcode.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Xcode 使用技巧
2018 年9 月18 日 5:03 pm | Comments
Alcatraz
Alcatraz是一款开源的用于Xcode7的插件管理工具.Xcode8以及以后版本需要配合下面的工具来使用.
update_xcode_plugins
update_xcode_plugins可以为Xcode中安装的插件添加UUID, 同时还能够 为Xcode8以及以上的版本解除签名,这样就可以随心所欲的使用各种Xcode插件了.
Reset Xcode’s “Load Bundles” warning
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-10.0
执行该命令,重启Xcode,可以使Xcode弹出”Load Bundles”的提示,可以重新load所有的插件.注意command末尾处的Xcode的版本号.
添加删除行 快捷键 Opt+D
修改配置文件(plist)权限
sudo chmod 666 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist sudo chmod 777 /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/
打开plist文件进行修改
open /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
找到root下的Deletions,在Deletions下添加一个Key: Delete Current Line 值为deleteToBeginningOfLine:, moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToBeginningOfLine:
重启Xcode,设置快捷键
Preference -> Key Bindings ,找到 Delete Current Line 选项,设置快捷键为 Opt+D
Xcode Release Build 版本号自动增加
if [ $CONFIGURATION == Release ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
buildnum=$(expr $buildnum + 1)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnum" "${plist}"
echo "Bumped build number to $buildnum"
else
echo $CONFIGURATION " build - Not bumping build number."
fi
使用方法 Xcode–>Projet–>Target–>Build Phases–>“+”–>New Run Script Phase. 顺序放在Target Dependencies之后即可,尽量靠前.
过程, 查找 Info.plist 文件的位置,使用工具 /usr/libexec/PlistBuddy 读取 CFBundleVersion 的值,+1后再写会 Info.plist 文件.
Posted by Spring
2018 年9 月18 日 5:03 pm
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK