iOS Gist

NSLog 被裁剪


NSLog 打印长字符串时会出现裁剪字符串的情况,网上搜到最多的方案是使用 printf 替代 NSLog,xcode debug时没有问题,但是对于使用日志系统访问输出台的方式并不适用。
NSLog底层调用 os/log.h os_log 实现,但是也并没有找到 可以修改buffer带下的api。
现在使用的方案是对字符串 gzip压缩后,在用base64,尽量减小字符串长度。

查看链接电脑USB设备信息,包含序列号等


执行system_profiler SPUSBDataType
结果

system_profiler SPUSBDataType
USB:

    USB 3.0 Bus:

      Host Controller Driver: AppleUSBXHCIWPT
      PCI Device ID: 0x9cb1
      PCI Revision ID: 0x0003
      PCI Vendor ID: 0x8086

        Bluetooth USB Host Controller:

          Product ID: 0x8290
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 1.67
          Speed: Up to 12 Mb/sec
          Manufacturer: Broadcom Corp.
          Location ID: 0x14300000 / 20
          Current Available (mA): 500
          Current Required (mA): 0
          Extra Operating Current (mA): 0
          Built-In: Yes

        AirPod Case:

          Product ID: 0x1393
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.00
          Serial Number: *****39XH8TT
          Speed: Up to 12 Mb/sec
          Manufacturer: Apple Inc.
          Location ID: 0x***00000 / 2*
          Current Available (mA): 500
          Current Required (mA): 500
          Extra Operating Current (mA): 0
          Sleep current (mA): 500

xcode8 升级 xcode 9.0 (9A235)


错误信息

['Missing recommended icon file - The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format'](https://stackoverflow.com/questions/18736954/missing-recommended-icon-file-the-bundle-does-not-contain-an-app-icon-for-iph)
lALPACOG84XChRrNAcvNAuQ_740_459.png_620x10000q90g.jpg

解决
找到打包好的 xcarchive 文件,执行

find Products/ -name Info.plist -print0 | xargs -0n1 plutil -replace BuildMachineOSBuild -string 16A323

自动导入证书p12


// 解锁 keychain
~ security unlock-keychain -p ****
// 导入证书 -k 指定导入位置,-T指定使用方 -P证书密码,空填""
~ security import yongbo.p12 -k /Library/Keychains/login.keychain -T /usr/bin/codesign -P ""
// 重新加锁
~ security lock-keychain

homebrew 安装失败(已安装xcode)

Failed during: /usr/bin/sudo /usr/bin/xcode-select –switch /Library/Developer/CommandLineTools

如果已经安装了xcode,还会报这个错误,可以尝试修改homebrew安装脚本,以下是修改流程。

1. curl -fsSL 
https://raw.githubusercontent.com/Homebrew/install/master/install.sh > ~/Desktop/brew.sh
2. xcode-select -p ,得到xcode中command line tools地址
2. 修改 brew.sh,找到 第169行  should_install_command_line_tools() 方法,把这个方法内的第一个 / Library/Developer/CommandLineTools/usr/bin/git 修改成 xcode-select -p 打印出来的地址

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容