
IOS
文章平均质量分 52
xixi_Lee
这个作者很懒,什么都没留下…
展开
-
iOS报 Expanded from macro ‘xxx‘
最近遇到一个挺有意思的错误文件 AppDelegate+SystemVersion.h@interface AppDelegate (SystemVersion)@end文件Const.h#define SystemVersion @"1"当在 AppDelegate+SystemVersion 里面导入了 #import “Const.h” 会到这个编译报错 expanded from macro 'SystemVersion'编译器将 AppDelegate 的分类名称 Syste原创 2021-10-18 22:25:02 · 3792 阅读 · 0 评论 -
解决 为什么会出现 “Safari浏览器打不开该网页,因为地址无效“ 的提示
背景来源场景:H5拉起APP ,使用的方式是 URL Scheme调用代码是location.href = "xixi:// "会出现当你点击了取消之后会出现 “Safari浏览器打不开该网页,因为地址无效” 提示语debug 调试了一下发现1、多次调用 location.href = "xixi:// " 点击取消是会出现2、如果调用了location.href = "xixi:// " 跟着也会调用 打开App Store ,点击取消也是会出现上面的提示语...原创 2021-03-03 13:47:42 · 13716 阅读 · 4 评论 -
解决 [!] Failed to connect to GitHub to update the CocoaPods/Specs specs rep
问题: [!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down解决:先更新一下 openssl再更新ruby 就可以了我是使用了Homebrew 的命令来更新如果你没有安装 你可以在终端执行下面的命令/bin/zsh -c "$(curl -fsSL https://gitee.com/c原创 2020-11-18 11:15:52 · 2103 阅读 · 0 评论 -
xcode iOS 一键运行自动打包shell脚本
2020-04-13下载地址# 项目自动、打包#赋予权限#chmod 777 auto_ipa.sh #项目的根目录路径PROJECT_PATH="$( cd "$( dirname "$0" )" && pwd )";#选择项目 xcodeproj or xcworkspace 这里是二选一 PROJECT_TYPE="xcworkspace"# 项...原创 2020-04-13 09:33:48 · 1805 阅读 · 8 评论 -
解决 CFBundleExecutable CFBundleSupportedPlatform错误
Unexpected CFBundleExecutable Key. The bundle at ‘Payload/appname_xixi.app/SicSDKResources.bundle’ does not contain a bundle executable. If this bundle intentionally does not contain an executable, co...原创 2020-04-12 23:28:48 · 5416 阅读 · 1 评论 -
CFBundleExecutable、associated-domains
一App Store Connect Operation ErrorUnexpected CFBundleExecutable Key. The bundle at 'Payload/xixi.app/SicSDKResources.bundle' does not contain a bundle executable. If this bundle intentionally does n...原创 2019-12-17 16:01:14 · 356 阅读 · 0 评论 -
当AFNetworking、NSURLSession、NSURLSessionDataTask遇到了信号量 dispatch_semaphore_t
假如 for 循环里面 调用方法 getDataFromAFN() 需要返回一个 BOOL 值,这个BOOL值又需要调用接口来决定。这个时候我们可以考虑使用信号量 dispatch_semaphore_t网络请求我们可以使用系统提供的 NSURLSession 和 NSURLSessionDataTask 或 使用 网络流行的第三方库 AFNetworking下面会罗列两种做法第一...原创 2019-12-10 15:43:48 · 220 阅读 · 0 评论 -
本地通知(UILocalNotification) - 隔几分钟或者几个小时进行一次通知
需求:每隔2个小时要进行一次 本地通知,通知客户进行 定位。 ask : 为什么要选择 本地通知呢? answer:1.开通后台持续定位 比较耗电 2.因为项目的原因 感觉 开启后台定位 可能 审核通过 难度比较大 好吧 废话少说 入正题一般来说 系统可以设置 每分钟,每小时 ,每天 这样来重复 本地通知 (repeatInterval) 但是有时候需求原创 2017-02-16 23:48:27 · 1043 阅读 · 0 评论 -
long long除以long long 或者 int除以int 为什么得到是0
首先看下 得到时 0 的代码是怎样写的int i_a = 10;int i_b = 20;NSLog(@"%f",i_a/i_b * 100.f);long long a = 32768;long long b = 153634;NSLog(@"%f", a/b *100.f);其实我们看下代码 我们应该感觉没有错的啊~~~但是为什么还是0 呢2016-12-16 21:17:25.5153原创 2016-12-16 21:25:08 · 13849 阅读 · 0 评论 -
iOS Xcode 查找项目里面的字符串
打开”Find Navigator”切换搜索模式到 “Find > Regular Expression”输入@"[^"]*[\u4E00-\u9FA5]+[^"\n]*?" (swift请去掉”@” 输入@"[^"]*[\u4E00-\u9FA5]+[^"\n]*?" 就好了原创 2017-03-03 23:20:35 · 2515 阅读 · 0 评论 -
iOS 在Unit Testing 里面使用第三方库
iOS 我们一般是使用 cocoapods 来管理一些第三方库,例如 AFNetworking , 但是我们有时候会加入 单元测试 Unit Testing, 而当我们想在 Unit Testing 里面使用第三方库的时候,你 #imoprt platform :ios,'8.0'target 'XiXi' dopod 'AFNetworking'endtarget 'XiXiTests'原创 2017-04-01 22:34:10 · 688 阅读 · 0 评论 -
xcode 回车enter 之后会自动缩进Tab
今天遇到一个怪异的问题 xcode 的配置没动过,但是 回车之后竟然会自动缩进 -(void) testa { }回车之后会变成上面这样。 一脸懵逼的我。解决方法: 大招 重启Xcode 即可原创 2017-04-20 10:33:14 · 7430 阅读 · 1 评论 -
解决 xcode pod 出现错误 PBXSourcesBuildPhase UUID
遇到的情况如下 pod install 之后 出现这个警告[!] `<PBXSourcesBuildPhase UUID=`FAD71C591E6D38D80044AA4D`>` attempted to initialize an object with an unknown UUID. `4EA3B01C1EBA243300FD27B7` for attribute: `files`. Thi原创 2017-05-09 09:46:09 · 4031 阅读 · 0 评论 -
iOS app 运行的时候和打包出来的app 不一样
第一次遇到这种情况,iOS app 运行的时候和打包出来的app 不一样。连接数据线run 起来 确实没问题,但是打包成ipa 安装 是真的有问题,然后将 edit scheme –> run –> build Configuration –>选择Release , 然后再运行一次,发现确实是有问题。然后再认真去查找下代码,确实是代码出了问题。 百思不得其解Debug 下是没发现到。原创 2017-06-22 23:15:46 · 1347 阅读 · 0 评论 -
创建一个 iOS 的 Widget (二)
——>>>>>创建一个 iOS 的 Widget (一)<<<<<——聊下 在项目里面 做展开和折叠 这个功能在iOS10 才出现的 并且样式 跟 iOS10 以下 是有点不一样的, iOS9 的左边 是留了一定的间距,而iOS10 是在屏幕的两边留了大概 7 的宽度。1.首先 TestWidgetDemo 的 ViewController.m 里面加入一个控制器 用于控制是否展开和折叠原创 2016-11-12 16:59:28 · 1729 阅读 · 0 评论 -
创建一个 iOS 的 Widget (一)
一. 首先 创建一个TestWidgetDemo 项目 二. 创建一个widget (方式如下)三. 跟着我们要开启共享App Group (因为要通过widget 这个group 来共享权限 获取数据,而这个Group 在哪里呢 要怎样设置呢? 看图) 假如我们在 developer 里面设置的group 叫做 group.xixi (项目里面的TestWidgetDemo原创 2016-11-12 15:48:09 · 536 阅读 · 0 评论 -
iOS 让数字保持两位数格式
NSLog(@"%02ld",2);NSLog(@"%0.2f",0.2656);NSLog(@"%0.2f",0.2646);注意的是%0.2f 是会对数字进行一个四舍五入2016-06-20 14:57:28.506 App[4010:98217] 022016-06-20 14:57:28.507 App[4010:98217] 0.272016-06-20 14:57:原创 2016-06-20 14:59:45 · 15110 阅读 · 0 评论 -
for 循环删除数组里面的多个对象 需要用到 removeObjectsAtIndexes
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]; for (int i = 0; i < dataArray.count; i++) { if (条件成立 记住这个i) { [indexSet addIndex:i]; } }原创 2016-08-09 12:37:30 · 2786 阅读 · 0 评论 -
waitUntilDone YES/ NO
记录 :总是记不住waitUntilDone:YES/NO 的区别效果如下 看代码YES or NO 结果都是一样 NSLog(@"before"); [self performSelectorOnMainThread:@selector(callBack:) withObject:nil waitUntilDone:NO]; NSLo原创 2016-08-10 11:45:18 · 657 阅读 · 0 评论 -
NSSelectorFromString 的使用,根据字符串来调用相应名字的方法
看代码[self doAction:@"testA" andArgObject:nil];[self doAction:@"testB:" andArgObject:@"xixi"];-(void) doAction:(NSString *)methodsName andArgObject:(id)objectArg{ SEL selector = NSSelecto原创 2016-08-10 12:19:34 · 2461 阅读 · 0 评论 -
ios 指定范围内的随机数
-(int)getRandomNumber:(int)from to:(int)to{ return (int)(from + (arc4random() % (to - from + 1)));}原创 2016-10-09 10:42:36 · 9793 阅读 · 1 评论 -
javascript 与 Object-C 的交互-(一)
OC 调用 JSJS 调用OC预备工作 首先要 导入 JavaScriptCore.framework 这个库,然后用来的类 分别是 JSContext , JSValue , JSExport 。再来一个 test.html 部分代码<a href="#" id="test">JS call OC</a> <style> a { disp原创 2016-10-26 15:26:34 · 427 阅读 · 0 评论 -
javascript 与 Object-C 的交互-(二)
iOS 的JS 和 OC 交互(一)好吧 今天继续再来搞搞 这个 交互的问题OC 怎样可以拦截到 JS 的调用,或者说 JS 怎样调用 才能让 OC首先来一段预备的 html 需要的代码这小段代码很简单,点击了一下 然后调用了 一个方法 <a href="#" id="test">JS call OC</a> <style> a { display:原创 2016-10-26 15:27:07 · 340 阅读 · 0 评论 -
iOS苹果IAP 充值
这次遇到的问题主要有两点1.税收那一块没有填好一些东西,这样会导致 在代码里面调用SDK 没有办法返回 预先创建好的商品类。2.进行付款时候 将记录进行本地存储。服务端也做这样的处理。 (毕竟这个是涉及到钱,谨慎一点好)假设 我选择的product_id : com.mytest.xixi这个id 是在 itunesconnect 设置好原创 2016-07-25 16:10:13 · 1812 阅读 · 0 评论 -
iOS App审核遇到的问题(持续更新)
Guideline 2.2 - Performance - Beta Testing –不能出现 test,demo,beta 这些字眼Your app contains references to test, trial, demo, beta, pre-release or other incomplete content.Please see attached screenshot原创 2017-08-31 11:22:49 · 44991 阅读 · 2 评论 -
iOS 监听数组的变化
1、首先我们有一个 testArray 这个数组需要监听 里面的 数据变化NSMutableArray *testArray;2、跟着 我们需要将这个数组 初始化 并且 赋予监听testArray = [NSMutableArray array];[self addObserver:self forKeyPath:@"testArray" options:NSKeyValueObservingOpt原创 2018-01-07 23:06:08 · 4999 阅读 · 0 评论 -
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad
Mac 系统更新到 macOS Catalina 10.15 之后 发现pos install 报错-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory解决:粗暴点,...原创 2019-10-08 15:42:40 · 2372 阅读 · 1 评论 -
iOS 商品分类demo -选中左边带动右边数据
商品分类由 一个UITableView 和 一个UICollectionView 组成UICollectionView 有Banner 、二级分类的标题、三级分类(icon 和名字)结构如图显示:当左边一级分类有数据的时候默认选中第一个NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];...原创 2019-07-10 15:24:45 · 1746 阅读 · 0 评论 -
iOS git ,sourceTree 忽略 cocoapods 文件
iOS git ,sourceTree 忽略 cocoapods 文件先copy 代码, 跟着下面的步骤# Xcode.DS_Store*/build/*xcuserdataprofileDerivedData.idea/*.hmap*.xccheckout*.xcworkspace!default.xcworkspace#CocoaPodsPods!Podfile...原创 2019-06-09 23:08:50 · 2289 阅读 · 0 评论 -
iOS XCode 解决 error: Unable to load contents of file list
问题: error: Unable to load contents of file listerror: Unable to load contents of file list: '/Users/xixi/abc/abc/Pods/Target Support Files/Pods-abc/Pods-abc-frameworks-Debug-output-files.xcfilelist'...原创 2019-03-26 21:16:41 · 21272 阅读 · 0 评论 -
iOS UIButton 渐变色、边框渐变色、字体渐变色
需求:1、UIButton 的背景需要渐变色2、UIButton 的边框需要渐变色,背景是白色,字体也需要渐变色需求一 : UIButton 的背景需要渐变色:思路:我们可以利用 CAGradientLayer 来做渐变色然而我不是直接套在UIButton 的layer 上面进行操作。我是1、 首先创建一个临时的 UIView2、 然后利用 CAGradientLayer...原创 2019-02-17 20:02:40 · 5867 阅读 · 2 评论 -
iOS 公共方法 不经常用
备用方便下去 copy/** 获取APP名字 */+ (NSString *) appBundleName{ return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];}/** 获取bundle Id */+ (NSString *) appBundleID{ return [...原创 2018-12-25 09:04:56 · 185 阅读 · 0 评论 -
iOS 图片要圆角 + 阴影投影 + 描边
iOS 图片要圆角 阴影投影 描边处理的方法是 阴影投影 用 CALayer 做底,然后设置一下 层级关系即可。UIImageView *avatarImgView = [[UIImageView alloc] init]; avatarImgView.frame = CGRectMake(20, 500, 80, 80); avatarImgView.layer.corn...原创 2018-12-05 14:14:15 · 3002 阅读 · 0 评论 -
iOS加载WebP
遇到场景:首先直播需要展示 礼物(会动的礼物)解决:按之前的考虑是 加载 gif , 但是gif 会产生锯齿导致礼物不好看,最后我们想到了webp , 我们将 UI 设计好的 png 几个帧数 合成了webp 格式。加载webp 我使用的是 YYWebImage首先加载执行 pod 'YYWebImage', '~&amp;amp;amp;gt; 1.0.5'跟着执行 pod 'YYImage/Web...原创 2018-11-17 12:34:17 · 5118 阅读 · 0 评论 -
iOS 获取 WKWebView 里面图片
背景:打开的文章H5能不能点击放大图片预览 并且保存啊?首先我们需要获取到 用户点击的范围所在的 图片那么我们可以做一个WKWebView 来专门处理这个事情。WKWebView (Images)-(void) addTapImageGesture{ UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer al...原创 2018-12-18 21:09:11 · 3771 阅读 · 0 评论 -
关于 未受信任的企业级开发者 提示的解决
如果点击APP 然后弹出这个提示,解决的方法如下 点击 手机系统的 设置 -> 通用 -> 设备管理 -> 点击证书 -> 信任原创 2018-03-21 11:04:16 · 8164 阅读 · 0 评论 -
Block implicitly retains 'self'; explicitly mention 'self' to
implicit retain of 'self'原创 2018-05-02 14:08:58 · 610 阅读 · 2 评论 -
模拟器8.1 文件夹 数据库的路径
模拟器8.1 数据库的路径 没有在原来那里了。 so 怎么办呢? 以sql原创 2014-11-24 16:28:50 · 755 阅读 · 0 评论 -
自定义对象里面的 针对 某个属性 / 字段 进行排序
GetDateTime 是自己定义对象里面的一个属性sqlitedb.tableDataList 是我从数据库里面查询出来的。里面包含的就是 自己定义的对象,就包含了 GetDateTime 属性 ofLineListDataArray = [NSMutableArray arrayWithArray:sqlitedb.tableDataList]; NSArray *原创 2015-01-23 17:14:10 · 535 阅读 · 0 评论 -
NSMutableDictionary 的value值去掉重复
将字典的 重复的value 值 去掉原创 2015-03-20 10:50:20 · 1667 阅读 · 0 评论