1:xcode工程文件乱序
选中文件夹、右键–>sort by name(sort by type)
2.编译报错:Illegal redeclaration of property in class extension ‘XXXXTableViewCell’ (attribute must be ‘readwrite’, while its primary must be ‘readonly’)
原因是我们 重复声明 了该属性,
解决办法:
删掉.h或者.m文件中多余的属性即可
3.编译报错Safe Area Layout Guide before iOS 9.0 [12]
XCode9以上引用了新特性的功能Safe Area,该特性不支持iOS9.0以下的系统
将该特性调成9.0以后的系统,正确做法如下
Builds for 默认会选中xcode的deployment target,Sage Area特效不支持9之下的,所以改成9.0以上的,当比9.0之下的app使用这个xib时,xcode也能够毫无问题地部署,
4.知识点集:信号量(dispatch_semaphore_signal)
dispatch_semaphore_wait 在哪个线程,就会堵塞到哪个线程
//crate的value表示,最多几个资源可访问
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
dispatch_queue_t quene = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//任务1
dispatch_async(quene, ^{
NSLog(@"zhouzhou -- run task 1");
sleep(5);
NSLog(@"zhouzhou -- complete task 1");
dispatch_semaphore_signal(semaphore);
});
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
NSLog(@"zhouzhou -- all complete return");
5.知识点集:监听任务完成 (dispatch_group_notify)
dispatch_queue_t queue = dispatch_get_main_queue();//dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
});
dispatch_group_notify(group, queue, ^{
});
6.知识点集:高德地图点击指南针后方向指示不动(不能转向)的问题
原因:当点击指南针图片后,会走这个方法,这个时候发现mode 已变成MAUserTrackingModeFollow,所以再设置回来手机移动方向指示就对了
6.编辑报错: Support Files/Pods-xx/Pods-xx.debug.xcconfig: unable to open file (in target “xx” in project “xx”) (in target ‘xx’)
解决:pod install (可能还会遇到7、8、9错误,往下看)
7.控制台报错:执行 pod install报错RuntimeError - [!] Xcodeproj doesn’t know about the following attributes {“inputFileListPaths”=>[], “outputFileListPaths”=>[]} for the ‘PBXShellScriptBuildPhase’ isa.
解决:gem update xcodeproj
8.控制台报错:执行 gem update xcodeproj报错Updating installed gems
ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
原因:服务域名更换公告. 因域名备案问题, .org 域名无法继续提供RubyGems 镜像服务,我们提供 .com 代替 .org 的域名,其他一切不变!! 详情访问.
解决:
gem sources --remove https://gems.ruby-china.org/
gem sources -a https://gems.ruby-china.com
gem sources -l
如果输出:
*** CURRENT SOURCES ***
https://gems.ruby-china.com
表示正确了
9.控制台报错:执行 gem update xcodeproj报错Updating installed gems
Updating xcodeproj
Fetching: nanaimo-0.2.6.gem (100%)
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
解决:sudo gem update xcodeproj
10.控制台报错:执行 sudo gem update --system报错YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR: SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR: You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Updating rubygems-update
ERROR: While executing gem … (Errno::EPERM)
Operation not permitted - /usr/bin/update_rubygems
解决:sudo gem update -n /usr/local/bin --system
11.控制台报错:执行 pod install报错You have either:
out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
mistyped the name or version.
not added the source repo that hosts the Podspec to your Podfile.
Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.
解决:sudo gem update -n /usr/local/bin --system
12.控制台报错:执行 pod search AFNetworking报错[!] Unable to find a pod with name, author, summary, or description matching AFNetworking
解决:rm ~/Library/Caches/CocoaPods/search_index.json
13.控制台报错:执行 pod install报错[!]/Library/Ruby/Site/2.0.0/rubygems.rb:289:in find_spec_for_exe: can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:308:in activate_bin_path
from /usr/local/bin/pod:23:in
解决:udo gem install -n /usr/local/bin cocoapods
14.Xcode10.2不再支持swfit3.0问题:or: SWIFT_VERSION 3.0 is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target ) 和 No visible @interface for declares the selector 问题
Target->Build Setting 搜索swift 找到swift Language Version选择支持的版本,我这里选的是5
此时调用swift方法依然会报错说:
No visible @interface for ‘ToolView’ declares the selector ‘initWithFrame:style:onClicked:’
再在swift方法前面添加上@objc