iOS~常用的相关命令

Xcode模拟器录屏的命令:

  1. 进入终端,cd到要放置录屏文件的位置

例如:cd Movies/

  1. 输入命令
xcrun simctl io booted recordVideo filename.mov

此处的filename是我们要保存的move的名称
停止录屏:在终端输入control + c,此处的control就是control键不是command

最后进入到对应文件夹就可以找到录制好的视频了。

git常用命令

  • 上传本地代码到Github
  1. 在Github上创建仓库
  2. 打开Mac终端,cd到本地项目的位置
cd /Users/apple/Desktop/Movies 
  1. 在本机本地址上创建一个 新的git仓库
$ git init 
  1. 添加本地项目
$ git  add .
  1. 提交信息
$ git commit -m "first commit"
  1. 管理远程仓库
$ git remote add origin https://github.com/SuiFengLiuNian/CALayerCoreAnimation.git
  1. 推送本地项目到远程
$ git push -u origin master

注意:删除本地的git目录

$ rm -rf .git/
问题
  • 如果提示fatal: remote origin already exists
    解决办法:
1、先输入 git remote rm origin
2、再输入 git remote add origin**************
  • 提示The authenticity of host 'github.com ' can't be established
git remote add origin******
The authenticity of host 'github.com ' can't be established(无法建立主机“github.com”的真实性)

可能是你的git地址采用了ssh方式,切换为https方式即可,也可能是你的仓库地址不对,可以用命令先查看一下:

 git remote -v

如果跟你的github地址不一样,那就去你的github上复制一下仓库地址
然后在终端中输入:

git remote set-url origin https://github.com/SuiFengLiuNian/CALayerCoreAnimation.git (这个是你的复制的仓库地址)

最后再push

git push origin master 

  • 添加代码到git
git add .
git commit -m "XXX"(XXX为注释内容)
git pull --rebase origin master
git push origin master


  • 更新远程分支
git remote update origin --prune 

LLDB命令

  • LLDB是开源的内置于Xcode的调试工具
  • 1.打印、需改值
    打印相关的命令有:p、po
    p和po的区别在于使用po 只会输出对应的值、使用p则会返回值的类型以及命令结果的引用名
lldb) p self.baseEffect
(GLKBaseEffect *) $0 = 0x000060000128d130
(lldb) po self.baseEffect
self = 0x60000128d130 - GLKBaseEffect
{
lightingType:       GLKLightingTypePerVertex
lightModelTwoSided: GL_FALSE
GLKEffectPropertyTransform = 0x7fe822626890
{
    modelviewMatrix
    {
    {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}
    }
    projectionMatrix
    {
    {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}
    }
    normalMatrix
    {
    {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}
    }
}
light0 =    NULL
light1 =    NULL
light2 =    NULL
material =  NULL
texture2d0 = 0x6000012846e0
GLKEffectPropertyTexture = 0x6000012846e0
{
    enabled =       1
    name =          0
    envMode =       GLKTextureEnvModeModulate
}
texture2d1 =        NULL
constantColor = {1.000000,1.000000,1.000000,1.000000}
fog =               NULL
}
  • P 还可以进行敞亮的进制之间的转换
//默认打印为10进制
(lldb) p 100
(int) $8 = 100
//转16进制
(lldb) p/x 100
(int) $9 = 0x00000064
//转8进制
(lldb) p/o 100
(int) $10 = 0144
//转二进制
(lldb) p/t 100
(int) $2 = 0b00000000000000000000000001100100
//字符转10进制数字
(lldb) p/d 'A'
(char) $7 = 65
//10进制数字转字符
(lldb) p/c 66
(int) $10 = B\0\0\0
  • expression修改参数值
//expression打印值
(lldb) expression width
(CGFloat) $5 = 67
//expression修改值
(lldb) expression width = 80
(CGFloat) $6 = 80
//打印修改后结果
(lldb) p width
(CGFloat) $7 = 80
(lldb) 
Permission denied

使用pods 有时候会出现如下错误:

Pods-resources.sh: Permission denied
解决如下:

终端cd到 /Pods/Target Support Files/Pods/Pods-resources.sh所在文件夹,然后执行如下命令:

chmod a+x Pods-resources.sh

该错误是由访问权限引起

你可能感兴趣的:(iOS~常用的相关命令)