CloudKit 问题集锦
字段识别Apple Developer
CloudKit
Class
String(list)
NSArray
String
NSString
Asset
CKAsset
Bytes
NSData
Date/Time
NSDate
Double
NSNumber
Int(64)
NSNumber
Location
CLLocation
Reference
CKReference
报错Field ‘___createTime’ is not marked sortable确保CloudKit的Schema中Indexes设置Sortable
URLSession
httpBody自定义格式func postHttp(params: [String:Any]) -> Void { request.httpBody = try! JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)}//使用let params = ["id":dataApiDrugs.descriptionID] as [String:Any]self.postHttp(url: "https://siboxapi.herokuapp.com/description/select", params: params)
使用模型func postHttp(params: PostParm) -> Void { request.httpBody = try! JSONSerialization.data(withJSONObject: params, options: .prettyPrinted) ...
Homebrew命令
Homebrew完美卸载软件及其依赖包brew tap beeftornado/rmtreebrew rmtree git #卸载git及其依赖安装包brew cleanup
Homebrew安装其他版本appbrew search node # 查找node版本brew install node@12 # 安装12版本brew unlink node@16 # 断开16版本的链接brew link --overwrite --force node@12 # 使用12版本
Swift CoreData @FetchRequest
@FetchRequest( entity: UserInfo.entity(), sortDescriptors: [ NSSortDescriptor(keyPath: \UserInfo.name, ascending: true) ], predicate: NSPredicate(format: "name == %@", "Lilei"))) var userinfoes: FetchedResults<UserInfo>
NSPredicate
描述了一个过滤器,我们将使用它来决定显示哪些结果
NSPredicate(format: "name == %@", "LiLei")
NSSortDescriptor
告诉我们要在哪个字段上进行排序,以及我们要它递增还是递减
NSSortDescriptor(keyPath: \UserInfo.name, ascending: true)
SwiftUI Picker
Picker 会根据平台显示所要展示的效果
Pickerstruct Picker<Label, SelectionValue, Content> where Label : View, SelectionValue : Hashable, Content : View
用法Picker基础用法var strengths = ["男", "女"]@State private var selectedStrength = 0var body: some View { Form { Picker(selection: $selectedStrength, label: Text("Strength")) { ForEach(0 ..< strengths.count) { Text(self.strengths[$0]).tag($0) } } ...
SwiftUI Picker
Picker 会根据平台显示所要展示的效果
Pickerstruct Picker<Label, SelectionValue, Content> where Label : View, SelectionValue : Hashable, Content : View
用法Picker基础用法var strengths = ["男", "女"]@State private var selectedStrength = 0var body: some View { Form { Picker(selection: $selectedStrength, label: Text("Strength")) { ForEach(0 ..< strengths.count) { Text(self.strengths[$0]).tag($0) } } ...
Xcode如何进行无线真机调试
Xcode 进行真机调试
登陆Xcode Team
链接手机Xcode菜单导航栏,选择 Window - Devices and Simulators
数据线链接手机,验证后会自动出现该手机信息,选中Connect via network 使手机可以无线测试
测试iOS工程中,选择该手机调试
Terminal(终端)使用代理进行连接
SS/Clash 等APP一般是Web代理,终端无法使用,需要单独配置代理
代理端口打开代理软件端口信息,查看HTTP 代理端口,SS的一般为1087,Clash一般是7890
编辑zshrc文件添加以下内容到 zshrc 中
alias proxy-on='export http_proxy=127.0.0.1:7890;export https_proxy=$http_proxy'alias proxy-off='unset http_proxy;unset https_proxy'
保存退出生效配置 source ~/.zshrc
开启命令 proxy-on
关闭命令 proxy-off
这样你就可以使用代理正常使用了,注意⚠️只在当前标签页生效,重新打开终端或新标签页需要重新执行 proxy-on
检查对比开启前后的IP变化
curl cip.cc
IP : 27.198.***地址 : 中国 山东 济宁运营商 : 联通数据二 : 山东省济宁市 | 联通数据三 : 中国山东省济宁市 | 联通URL : ht ...
解决docker-compose 命令不存在、未找到命令错误
安装安装扩展源sudo yum -y install epel-release
安装python-pip模块sudo yum install python-pip
查看docker-compose版本docker-compose version
提示未找到命令
通过以命令进行安装cd /usr/local/bin/wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64rename docker-compose-Linux-x86_64 docker-compose docker-compose-Linux-x86_64chmod +x /usr/local/bin/docker-compose
再次查看
docker-compose version
命令
compose以守护进程模式运行加-d选项
docker-compose up -d
查看有哪些服务
docker-compose ps
查看compose日志
docker ...
macOS brew安装redis
安装Homebrew/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装完成后写上下面的配置,目的是为了关闭homebrew每次检查更新(加快速度)
关闭:export HOMEBREW_NO_AUTO_UPDATE=true打开:export HOMEBREW_NO_AUTO_UPDATE=false
安装Redisbrew install redis
命令
启动Redis#后台启动redis-server &
关闭Redisredis-cli shutdown
验证程序redis-cli ping
看到pong就代表成功了
其他配置vim /usr/local/etc/redis.conf修改 daemonize no 为 daemonize yes 默认启动就后台运行其中修改密码是 requirepass foobared => requirepass pwdcode这里把密码设 ...