
原创
Rex_Code
技术菜,又懒惰、不上进
展开
-
FMDB数据库损坏 database disk image is malformed, code:11
FMDB数据库损坏 database disk image is malformed, code:11使用FMDB数据库的时候,有时会遇到 数据库损坏的问题,FMDB又没有提供修复工具,导致App数据库无法打开,只能删除数据库,这样不是很友好。解决方法是 ,使用 WCDB(微信的数据库) 替换,作为数据库工具,WCDB 提供修复功能,能解决 SQLite 错误码 11、26的问题。如果之前是用FMDB,也可以同时引入 WCDB,然后用WCDB 来备份,发生错误的时候,就可以用WCDB来修复。..原创 2022-02-25 20:46:22 · 1098 阅读 · 0 评论 -
tableView 不走 didSelectRowAt 代理方法
tableView 不走 didSelectRowAt 代理方法今天同事写了个tableView,结果点击不走代理方法 didSelectRowAt检查了一遍,tableView frame 没问题,没有手势拦截,cell 上面也没有其他控件拦截。最后发现问题在这tableView.allowsSelection = true主要是他用 xib 拉的控件,找了半天也没发现,最后还是各种搜索才解决了。...原创 2021-11-22 16:44:04 · 1552 阅读 · 0 评论 -
iOS tabbar颜色适配
// 设置标题颜色 let normal_attr = [NSAttributedString.Key.foregroundColor: UIColorFormRGB(rgbValue: 0x202020)] let select_attr = [NSAttributedString.Key.foregroundColor: normalRedColor] if #available(iOS 13.0, *) { let...原创 2021-07-23 12:07:58 · 367 阅读 · 0 评论 -
The certificate used to sign “XXX“ has either expired or has been revoked.
The certificate used to sign “XXX” has either expired or has been revoked. An updated certificate is required to sign and install the application.乍一看,不就是证书过期或被撤销了,然后想着重新搞下证书就好。然后搞了一下,发现不行,一运行还是报同样的错误。于是无奈Google一番,得到的答案基本也是重新搞证书。搞了一个小时,怎么试都不行。后来看到手机的一个ap原创 2021-07-17 10:15:12 · 811 阅读 · 4 评论 -
iOS WKWebView 点击图片放大
iOS WKWebView 点击图片放大func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { /// 禁止缩放 let injectionJSString = """ var script = document.createElement('meta');\ script.name = 'viewport';\原创 2021-06-09 11:12:25 · 1208 阅读 · 0 评论 -
Mac big sur天气小组件定位、位置选择
mac big sur 天气小组件 切换位置1.点击底部的 编辑按钮2.编辑状态选中天气小组件3.此时就能编辑位置了最后:如果想显示多个地区的天气,就添加多个天气小组件即可。原创 2021-05-14 10:21:08 · 5094 阅读 · 0 评论 -
M1 Mac 安装 cocoapods
基于开启VPN1.sudo gem install cocoapods -n /usr/local/bin sudo gem install ffipod setup参考原创 2021-05-13 22:49:03 · 502 阅读 · 0 评论 -
M1 Mac YYKit 报错
ld: in /Users/xxxxxx/Desktop/xxxxxx/xxxxxx/Pods/YYKit/Vendor/WebP.framework/WebP(libwebpencode_la-config.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64解决方法:加上 arm64 即可参考原创 2021-05-13 22:28:05 · 3579 阅读 · 0 评论 -
卡住在 Cloning spec repo ‘cocoapods‘ from ‘https://github.com/CocoaPods/Specs.git‘
卡住在 Cloning spec repo ‘cocoapods’ from ‘https://github.com/CocoaPods/Specs.git’解决:去官网手动下载 https://github.com/CocoaPods/Specs然后解压 放到 ~/.cocoapods/repos/cocoapods记得要把 .git 文件夹 放到 cocoapods 目录下...原创 2021-05-10 16:22:22 · 5581 阅读 · 0 评论 -
iOS文字间距对齐
用的是比较笨的办法,通过设置文字间距来实现,直接来代码/// 创建订单选项视图 /// - Parameters: /// - itemName: 选项名称,如:手机号 下单时间 /// - contentStr: 选项对应的具体值 /// - count: 选项名称的文字个数,如 手机号有3个文字,下单时间有4个文字 /// - Returns: 创建好的视图 func createOrderItemInfoView(itemName: St.原创 2021-04-16 11:53:25 · 382 阅读 · 0 评论 -
iOS 延迟搜索 实时搜索
在实现搜索功能的时候,搜索框的值发生变化,我们不可能每次都去调用接口,应该等用户结束输入的时候再去调用接口搜索,记录搜索框的值发生变化的间隔,可以比较有效的监听用户的输入状态。/// 上一个输入的时间,避免每次输入都调用搜索接口@property (nonatomic, assign) __block NSTimeInterval preInputTime;#pragma mark - 搜索相关- (void)textFieldValueDidChange:(UITextField *)textF原创 2021-01-22 16:17:29 · 724 阅读 · 0 评论 -
iOS 拨打电话
第一种NSString *phoneStr = [NSString stringWithFormat:@"tel://%@",phone];if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) { //设备系统为IOS 10.0或者以上的 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneStr] options:@原创 2020-12-23 11:40:15 · 1320 阅读 · 0 评论 -
PCH文件引入pod头文件报错
今天接手了一个项目,是比较旧的,第三方库都是直接手动拖进来的,没有使用cocoapods,我使用cocoapods增加了一些三方库,把头文件写到PCH文件的时候,报错,说找不到对应的文件。路径那些是没有问题的可以试下 这样来解决:#ifdef OBJC#import <YYKit.h>#endif或者#ifdef __OBJC__#import <YYKit.h>#endif...原创 2020-12-08 08:54:22 · 558 阅读 · 0 评论 -
ios 项目运行 you don‘t have permission to view it
The file “.app” couldn’t be opened because you don’t have permission to view it照着这些来,都没能解决,最后这个解决了,在xcode的菜单栏File -> Workspace Settings -> Build System: Legacy Build System选择传统的 Legacy build system 就可以了。最神奇的是,我选了Legacy build system,项目跑起来后,我再切原创 2020-11-25 11:15:13 · 1525 阅读 · 1 评论 -
Mac 隔空投送 AirDrop 搜不到 iPhone
最近在使用 隔空投送 AirDrop 的时候,遇到 iPhone 能搜到 Mac,但是 Mac 搜不到 iPhone 的情况,可以试下下面的方法来解决:把iPhone设置成飞行模式,然后再关闭飞行模式,Mac 就能搜到iPhone。Mac 的 iCloud 账号 退出登录,iPhone 的 iCloud 账号 退出登录,然后重启Mac 和 iPhone,最后重新登录 Mac 和 iPhone 的 iCloud 账号 ,就能解决。...原创 2020-10-12 10:48:17 · 8865 阅读 · 0 评论 -
Launchpad 大小
具体方法如下:在Terminal下执行一下命令:defaults write com.apple.dock springboard-columns -int 10defaults write com.apple.dock springboard-rows -int 8defaults write com.apple.dock ResetLaunchPad -bool TRUEkillall Dock1、调整每一列显示图标数量,10表示每一列显示10个,比较不错,可根据个人喜好进行设置。原创 2020-08-19 09:43:19 · 146 阅读 · 0 评论 -
Mac 最新安装 HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"卡住在==> Tapping homebrew/coreCloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...终端安装,运行这个git clone git://mirrors.ustc.edu.cn/homebrew-原创 2020-08-19 09:08:00 · 203 阅读 · 0 评论 -
Protocol Buffers 在iOS的使用
Protocol Buffers 简单的说是对结构化的数据进行序列化(Json格式、XML格式)的一种语言,但是更小、更快、更简单,更多的用于IM即时通讯这一块,有助于节省流量,提高性能。Protocol Buffers 是谷歌的,官网连接现在我们来简单的体验下 Protocol Buffers 在 iOS 的使用。安装使用环境,打开终端安装 homebrew通过 homebrew 安装其他需要的工具brew install automakebrew install libtoolbrew原创 2020-08-12 16:02:28 · 828 阅读 · 0 评论 -
iOS 按钮 Button 高亮不变灰
iOS button 点击高亮的时候不变灰, 把按钮类型改为自定义即可 _continueBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_continueBtn setBackgroundImage:[UIImage imageNamed:@"mhsq_history_continue"] forState:UICont...原创 2019-11-28 10:51:24 · 1291 阅读 · 0 评论 -
IM聊天会话列表,时间简单判断
IM聊天会话列表,时间简单判断//时间显示内容-(NSString *)getDateDisplayString:(long long) miliSeconds{NSLog(@"-时间戳---%lld_----",miliSeconds);NSTimeInterval tempMilli = miliSeconds;NSTimeInterval seconds = tempMilli/...原创 2019-11-06 15:58:11 · 2843 阅读 · 0 评论 -
ios tableView的约束警告,NSLayoutConstraint:.width == 0
Unable to simultaneously satisfy constraints.Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out whic...原创 2019-10-14 16:52:33 · 1522 阅读 · 0 评论 -
iOS 审核解决中心-附件-无法载入文件
iOS 审核被拒的时候,在审核解决中心添加附件的时候,提示 无法载入文件 ,造成这个原因主要是上传的附件名称中包含了中文,所以重命名一下附件,不要带有中文就好,最好也不要搞特殊符号。...原创 2019-06-11 16:40:14 · 3000 阅读 · 0 评论 -
微信授权登录 界面 “确认登录”无响应
微信授权登录 界面 “确认登录”无响应在调起微信授权登录界面时,点击 “确认登录”没有反应,可能是 scheme appid 没有配置正确原创 2019-04-08 10:48:47 · 9716 阅读 · 0 评论 -
iOS IPA上传被拒,info.plist缺少定位权限描述
Dear Developer,We identified one or more issues with a recent delivery for your app,“XXXX”. Please correct the following issues, then upload again.“Missing Purpose String in Info.plist File. Your ...原创 2019-03-29 18:02:11 · 6072 阅读 · 5 评论 -
ERROR ITMS-90174: "Missing Provisioning Profile - Apps must contain a provisioning profile in a file
ERROR ITMS-90174: “Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision.”出现这个问题,主要是在打包的时候 Provisioning 文件没有选中,在打包选择证书的时候选中对应 provisioning ...原创 2019-03-07 20:11:45 · 1408 阅读 · 0 评论 -
iOS xib storyBoard scrollView如何在超出屏幕的部分添加控件
使用 xib、storyBoard 搭建界面的时候,如果需要在scrollView 中添加足够多的控件,那超出屏幕的部分要怎么添加呢?一种方法是 先把 view 移到屏幕中间,搭建完成再移回去,但是感觉这样不是很好。其实可以把控制器的 view 的 size 设置为 freeform 就可以决绝这个问题,就类似 xib 中把 view 的 frame 设置为 freeform这样就可以添加...原创 2019-01-28 10:24:41 · 2162 阅读 · 0 评论 -
网易七鱼客服 发起客服-触发两条会话
今天集成网易七鱼客服的时候,每次调用的时候,客服端都会收到两条会话信息这其实是同一个人来的,本来挺简单的东西,硬是搞了一天。出现这个原因,主要是因为我们在分配客服的时候,需要为客户指定同一个客服,然后我们的后台返回客服信息的时候,多调了网易的接口,最后导致每次连接客服的时候,都会有两条会话。发现问题原因,解决起来就简单了,后台修改了他的逻辑,然后就没事了。...原创 2019-01-27 10:58:22 · 1184 阅读 · 0 评论 -
Reason: image not found
出现这个 原因,就是第三方的 framework 找不到有人说把对应的 framework 改为 optional ,就可以运行。但这是治标不治本,代码运行到对应的framework 引用的地方,还是会崩溃。其实只要把 framework copy 到项目就好了...原创 2019-01-15 17:51:04 · 909 阅读 · 0 评论 -
iOS 设备型号判断
1.导入头文件:#import <sys/utsname.h>2.在 要获取的方法中添加:struct utsname systemInfo;uname(&systemInfo);NSString *model = [NSString stringWithCString: systemInfo.machine encoding:NSASCIIStringEncodi...原创 2018-12-30 17:12:47 · 1554 阅读 · 0 评论 -
SDWebImage设置图片发生错误
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSDictionaryI image]: unrecognized selector sent to instance 0x283a94900’发生这个错误主要是因为传入的值不对,传入的是一个NSDictionary,正确的应...原创 2018-11-15 10:04:23 · 414 阅读 · 0 评论 -
The iOS deployment target is set to 6.0, but the range of supported is 8.0 to 12.0
The iOS deployment target is set to 6.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0.(in target ‘Masonry’)xcode 第三方框架黄色警告:消除警告:把对应的第三方框架的deployment targ...原创 2018-10-05 18:19:02 · 8867 阅读 · 0 评论 -
Xcode This action could not complete
今天运行xcode的时候,发现签名提示账号过期了,要重新登录。然后去登录,发现怎么登录都是 提示 This action could not complete. Try again! 然后上网找了各种资料,都是说修改 /Users/Shared 文件夹的权限,或者删除 /Users/Shared 文件夹下的隐藏文件夹 adi文件夹,都不行。然后怀疑账号密码不对,于是登录开发者中心网站,发现完全...原创 2018-07-23 10:57:35 · 271 阅读 · 0 评论 -
android studio 3.0之后Unable to resolve dependency for ':app@debug/compileClasspath':
Unable to resolve dependency for ‘:app@debug/compileClasspath’: Could not resolve com.android.support:appcompat-v7:26.1.0升级了android studio 3.0 之后,就莫名的发生了很多错误,新建的项目一样有一堆的错误,gradle 也无法更新,有人说是网络问题,有人...原创 2018-04-15 09:15:06 · 46688 阅读 · 19 评论 -
Android Studio 导入融云IMlib moduler 导致IDE Fatal Error
本人Android 菜鸟一枚,刚入坑,最近在搞IM聊天的时候使用的融云的SDK,一开始是直接使用IMKIT来完成粗陋版本的,但是IMKit不太容易定制UI,所以后来想基于IMLib进行开发,于是导入 IMLib的过程中就发生错了,按照官方的步骤来,导入的时候发生IDE如下错误: 各种百度谷歌都没能解决这个问题,融云的人对你爱理不理,我都不想用融云了,奈何公司的决策人要使用。无奈,只能继续...原创 2018-04-11 17:24:57 · 1136 阅读 · 0 评论 -
Android Device Monitor 打不开
Android Device Monitor 打不开,发生错误解决方法:关掉 Android Studio ,然后以管理员的身份运行 Android Studio ,可能打得开。可能是JDK的版本不对或者不兼容,笔者的JDK是9.0以上的,貌似不兼容,然后重新安装8.0的版本,就可以打开了。...原创 2018-03-19 17:58:48 · 2326 阅读 · 0 评论 -
Application Installation Failed
Application Installation Failed已经修改了 build.gradle 文件中的 applicationid,还是会覆盖冲突,笔者出现这个问题的原因主要是用了第三方的推送,需要配置第三方的推送权限,解决的办法主要是把 build.gradle 中的 applicationid 和 第三方推送的配置文件的 authorities 的名字改为一样的就可以了(第三方推送...原创 2018-03-19 10:39:58 · 2639 阅读 · 1 评论 -
Execution failed for task':xxx:processDebugGoogleServices' No matching client found for pack 'xxx'
Execution failed for task’:xxx:processDebugGoogleServices’ No matching client found for pack ‘xxx’笔者出现这个错,主要是因为用到了Google 的 GCM,出现这个原因主要是 applicationid 和 google-servies.json 文件里面的 package_name 不一样造...原创 2018-03-19 10:19:54 · 3863 阅读 · 1 评论 -
ExpandableListView、ListView EditText 输入数据混乱的问题
如图所示,可以点加号减号修改数量,也可以直接点击进行输入 ExpandableListView、ListView EditText 输入数据混乱的问题,在ExpandableListView和ListView的Item中有EditText输入框的时候,在输入的时候,如果不做处理就会发生混乱,这个问题主要是由复用Item造成的,简单地解决方法就是不复用Item,但这样会带来性能问题,数据量大的时候就原创 2017-12-20 11:20:38 · 1994 阅读 · 2 评论 -
called detach on an already detached child ViewHolder
在为RecycleView添加头部视图的时候,添加一个的时候没有问题,正常运行;添加两个头部视图的时候,就崩溃了,错误信息如下: 添加头部视图的代码: 这里添加头部视图的时候是在 activity 中添加的,inflate 中的第二个参数是 recycleView,笔者上网查了一下,发现没什么人遇到这个BUG,遇到的人也没说出个所以然来,也没有解决的方案。笔者是个菜鸟,发生这个错误的原因也不是很原创 2017-10-13 10:41:28 · 3110 阅读 · 0 评论 -
android json 解析
笔者是刚入门的菜鸟,不足之处,请多多指教,谢谢。笔者的网络请求用的是OKHTTP,JSON解析用的是GSON。下面是请求成功的返回方法: @Override public void onResponse(Call call, Response response) throws IOException { // 请求的结果原创 2017-09-13 11:41:19 · 332 阅读 · 0 评论