记录开发中遇到的坑或者Bug<持续更新...>
2017-01-13 22:29
821 查看
错误一:
diff: /../Podfile.lock: No such file or directory diff: /Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
可能复现的场景:
github或者git.OSChina下载使用到CocoaPods的Demo,有的时候因为依赖关系或者版本问题不能编译运行。
解决方案:
1>关闭当前的工作空间,删除掉文件夹中的workspace,
2>终端 cd 到工程文件夹 –> 先执行pod setup –> 再执行pod install 即可
错误二:
Analyzing dependencies [!] The dependency `SDWebImage (~> 3.6)` is not used in any concrete target. The dependency `TTTAttributedLabel` is not used in any concrete target. The dependency `AFNetworking (~> 2.6)` is not used in any concrete target. The dependency `MJRefresh` is not used in any concrete target. The dependency `MBProgressHUD` is not used in any concrete target.
出现原因:
使用cocoapods的时候,podfile文件没有指定target
解决方案:
1>打开Podfile –> 指定target
2>例如下:
target 'Demo' do pod 'SDWebImage', pod 'TTTAttributedLabel' pod 'AFNetworking' pod 'MJRefresh' pod 'MBProgressHUD' end
错误三:
To github.com:******.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:******.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
出现原因:
GitHub远程仓库中的有文件不在本地仓库中。
解决方案:
$ git pull --rebase origin master $ git push -u origin master
错误四:
Use of undeclared identifier 'ddLogLevel'
出现原因:
CocoaLumberjack
框架引起
解决方案:
在CocoaLumberjack.h
中加入以下代码
#ifdef DEBUG static const int ddLogLevel = DDLogLevelVerbose; #else static const int ddLogLevel = DDLogLevelError; #endif 意思是在DEBUG模式下打印DDLogLevelVerbose级别日志,RELEASE模式下只打印DDLogLevelError级别日志。
错误五:
"_OBJC_CLASS_$_CompareResult", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
出现原因可能有很多,其中之一:
一个类中定义了同时另外一个类,比如在Class类的Class.h中又声明了类Class1
@interface Class1 : NSObject @end
解决方案:
忘记了在Class.m中添加实现,添加以下代码即可
@implementation Class.m @end
错误五:
警告:warning: Deprecated: Push segues are deprecated since iOS 8.0
Modal segues are deprecated since iOS 8.0
复现场景:
使用storyboard时,界面跳转使用了Push方式,如图:
可以发现Push和Modal均已过时
解决方案:
使用Action Segue代替原来的Push和Modal方式.
错误六:
警告:CUICatalog: Invalid asset name supplied
复现场景:
使用到UIImage的imageNamed:方法时传入的参数是@”“引起
解决方案:
传进去有值的参数即可
错误七:
崩溃[__NSArrayI objectAtIndex:]: index 9223372036854775807 beyond bounds [0 .. 2]'
复现场景:
OC或Swift数组或字典越界造成
解决方案:
判断后使用:
if (selectedIndex != NSNotFound) { //使用selectedIndex }
错误八:redundant conformance of to protocol
原因:该协议已经被遵守,不需要在此extension
后遵守,直接实现对应的协防方法即可
复现场景:
比如下面的错误,当前已经是UITableViewController
,所以不需要写tableView.dataSource = self
,也不用遵守协议
Redundant conformance of 'TableViewController' to protocol 'UITableViewDataSource'
解决方案:直接在extension
里面实现协议方法即可
extension TableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCell(withIdentifier: "ID"); if !(cell != nil) { cell = UITableViewCell(style: .default, reuseIdentifier: "ID") } cell?.textLabel?.text = "123" return cell! } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 10 } }
相关文章推荐
- Swift / Objective_C / Xcode实际开发中可能遇到的小功能小技巧总结<持续添加更新...>
- Java小技能点汇总(一)<日常开发中遇到的一些小知识点-长期更新>
- NC(netcat)应用全记录<持续更新>
- 钉钉环境下H5开发微应用遇到的问题和BUG(持续更新)
- Android 开发过程中遇到了一个问题 小记录一下 ERROR: In <declare-styleable> BorderLinearLayout, unable to find attribu
- JQuery插件(web设计、开发工具)收藏<持续更新>
- JNI开发遇到的一些问题记录(持续记录更新)
- Oracle报表开发中遇到的问题记录(持续更新。。)
- 每天的记录,慢慢来。<十二月> December ··········持续更新中
- asp.net开发中遇到的奇葩bug及解决办法(会持续更新。。。)
- iOS 开发过程中遇到的Bug和Warning收录(持续更新)
- Leetop/Ext-Desktop Web桌面 项目开发实录<持续更新中....>
- <持续更新>ubuntu下开发环境常见问题解决
- iOS开发--好用的第三方库(OC)<持续更新>
- android 开发中遇到的一些小的知识点在此做一个记录(持续更新)
- 开发中遇到的bug(持续更新)
- Ext-Desktop Web桌面项目 Leetop 开发<持续更新中....>
- 图像处理公共数据库下载地址集锦<持续更新中>
- Android开发遇到的问题笔记(持续更新)