Xcode
Last updated
Was this helpful?
Last updated
Was this helpful?
非 Retina 屏幕,Theme 主题推荐:Civic
Retina 屏幕,Theme 主题推荐:Midnight
Xcode 正式版下载地址:
Xcode 新版本在 Mac App Store 中更新的会比上面的网站快
Xcode beta 版下载地址:
Xcode 更新问题:
处理在 Mac App Store 中下载成功,但是自动更新失败的情况
打开活动监视器
,搜索download
,点击进入详情,选择打开的文件和端口
在列表里面可以看到下载的Xcode所在目录,点击就可以更新了
注:按住 option,点击正在提示正在安装
App,可以删除下载的缓存
模板保存路径:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source
代码块保存路径:
~/Library/Developer/Xcode/UserData
没有代码块的路径
~/Library/Developer/Xcode/UserData/CodeSnippets
有代码块的路径
Archives 路径:~/Library/Developer/Xcode/Archives/
DerivedData 路径:~/Library/Developer/Xcode/DerivedData/
Provisioning Profiles 文件夹:~/Library/MobileDevice/
FrameWork 库路径:~/Library/Developer/Xcode/DerivedData/Build/Products
$(SRCROOT)代表的时项目根目录下 $(PROJECT_DIR)代表的是整个项目
PS:往项目添加文件时,例如.a等,要先show in finder ,复制到项目中,然后再拖到xcode项目中
而有时,我们的.a不在工程目录中,比如在工程的父目录上,可以写成:$(SRCROOT)/../YSKit/libWeChatSDK。其中/../ 就是指向父目录。
/Library/Developer/CoreSimulator/Profiles/Runtimes/
直接进入可以删除
cd 到路径:~/Library/Developer/Xcode/Archives/
,
然后找到今天打包的文件,选择“显示包内容”获取到DSYM文件。
Build Setting -> Debug Infomation Format
选择 DWARF with dSYM File
一般默认选择 DWARF
1、保存路径:
~/Library/Developer/Xcode/UserData/CodeSnippets
Tips:选中代码,然后单击选中的地方,等鼠标变成箭头就可以进行拖动代码了
2、代码块设置
添加操作:选中代码,单击,长按,然后拖动到右下角代码块区域
变量的使用:<#xxxName#>
Example:<#mark#>、<#type#>、<#value#>
<#xxxName#> 快速打开代码块所在文件夹: open ~/Library/Developer/Xcode/UserData/CodeSnippets
上面这个目录是你添加了自定义代码块之后才会出现
代码块命名规则说明:
vXXX:表示变量(Variable) 的代码块
focmethod:表示方法(OC Function) 的代码块
fswiftmethod:表示方法(Swift Function) 的代码块
mark:表示添加:// MARK: - XX
cd 到路径:Xcode_Beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
添加到路径:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
去下载最新的 Xcode Beta 版本:
就是 download 多了一个 s 😂
进入进入目录:Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
,导出最新版本的iOS设备镜像文件
导入最新版本的iOS设备镜像文件到目录:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Index Disable
defaults write com.apple.dt.Xcode IDEIndexDisable 1
defaults write com.apple.dt.Xcode IDEIndexDisable 0
索引有问题,需要删除 DerivedData!
设置显示编译时间
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
提高XCode编译时使用的线程数
defaults write com.apple.dt.Xcode PBXNumberOfParallelBuildSubtasks 8
4 核CPU时设置 8 个线程编译
/Users/yourusername/Library/Developer/Xcode/DerivedData ~/Library/Developer/Xcode/DerivedData ~/Desktop/Xcode.app
清除 Archives rm -rf ~/Library/Developer/Xcode/Archives/*
清除 DerivedData rm -rf ~/Library/Developer/Xcode/DerivedData/*
查看 Provisioning Profiles 文件夹 ~/Library/MobileDevice/ open .
很多设置Xcode已经默认了
将Debug Information Format改为DWARF默认
将Build Active Architecture Only改为Yes默认
可以检查出比较耗时的方法
在 Build Settings --> Other Swift Flags 中加入
-Xfrontend -warn-long-function-bodies=100 (100 意味着 100 毫秒, 这个数字具体设置多少要依电脑配置和项目大小而定,建议多调整几遍找到大小相对合适的数字,ps: 1 秒= 1000 毫秒)
-Xfrontend -warn-long-expression-type-checking=100
xcodebuild clean -scheme Amy
使用快捷键:cmd + T
注释快捷键:Command + option + /
注释失效-Xcode快捷键 注释快捷键失效的问题
关闭 Xcode
打开 Finder,重命名 Xcode1.app
打开 Xcode,关闭 Xcode
修复完成
添加读写权限:sudo chmod 777 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source
拷贝模板到相应目录:sudo cp -R /Users/yourusername/Desktop/GuowenWang.xctemplate /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File\ Templates/Source
使用脚本来执行保存操作:
模拟器占用内存好大。。。
下载:Xcode beta 版下载地址: