Bug(2019-4-1)
Linker command failed with exit code 1(use-v to see invocation)
为什么会出现这样的问题呢?
是因为在 Build Phases
下的 Compile Sources
中没有把你项目中的.swift 文件添加进入,怎么会找的到(Link),怎么能够进行编译呢?!所以,修改这个bug,只需要把你的项目中文件添加进入就ok。
Bug(2019-4-2)
在使用xcode9.0集成HandyJSON的时候,安装成功,编译却一直不会通过。使尽各种方法,最终还是给我尝试到了。这里分享一下我的经验:
在我配置了cocoaPods之后,在Podfile文件中做如下配置:
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'Demo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Demo
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'HandyJSON','4.1'
#pod 'HandyJSON', git: 'https://github.com/alibaba/HandyJSON.git' , branch: 'dev_for_swift5.0'
end
可以看到我在其中一共集成了三个函数库:Alamofire
, SwiftyJSON
, HandyJSON
.
第一次使用的HandyJSON的版本是 'HandyJSON', '4.2.0'
然后是 'HandyJSON', '4.2.0-beta1'
安装之后的编译结果都会报错。
错误内容是:Undefined symbols "_swift_getFieldAt"
这个在github上找到的原因是,函数库自身在适配swift时的bug。
遇到问题了,当然要想法设法的去解决。然后进行百度搜索,尝试很多博客中指出的方法,没有成功。这时候一个上午已经过去了,下午也到15点了。没办法进github翻翻 issue 吧。也找了好多同样问题的帖子。
解决方法一
解决方法二
都不管用,尝试了高版本的HandyJSON几个。由原来的旧问题,变成了新的问题。如下图展示:
错误内容是:"_swift_getTypeByMangledNameInContext", referenced from:
有说使用高版本xcode进行适配。但是我的电脑又不支持太高的xcode版本。而且我突然想到这个HandyJSON之前的旧版本也一直在使用啊,而且在issue上提出了好多相关的问题。由此,我想到了试一试低版本的HandyJSON。然后就用了上面的pod 'HandyJSON','4.1'
果然就成功了。 所以,当有朋友遇到这种编译问题(只针对初学者)可以尝试一下各种版本进行试用!
Bug(2019-4-9)
一个XIB小问题让我处理了2天,哈哈!问题就在于这里:
第一次使用XIB画图的时候是ok的,只是后来修改了一下“大V的变量名”然后在对应的XIB中没能同步修改,所以就报上面的错误。当然,从这个过程中学到的则是,如果去看打印的错误日志。因为上面标注的很清楚:Terminating app due to uncaught exception NSUnKnownKeyException: this class is not key value coding-compliant for the key vipImageView .
Bug(2019-4-10)
引入第三方函数库报错,Value of type [UIView] has no member compactMap
是因为我直接引入了 pod 'IBAnimatable', '5.1.0'
根据官方,作出正确的解决方法
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
target 'Demo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Demo
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'HandyJSON','4.1'
#pod 'HandyJSON', git: 'https://github.com/alibaba/HandyJSON.git' , branch: 'dev_for_swift5.0'
pod 'Kingfisher', '4.1.1'
# Pods for JNUHonorSchoolStudentPlatform
pod 'IBAnimatable', '5.0.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'IBAnimatable'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.0'
end
end
end
end
Bug(2019-4-17)
- 偶遇壹
在使用xcode(9.0)进行XIB画图,编译出错
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 'this class is not key value coding-compliant for the key avatarView.'
出现这个问题说明,拖到XIB的view在进行连线时候,1)连线不对;2)一个view被重复或者多次连线。都会出现上面的错误。
如果是出现的问题(2)会有很多个连线,在这里进行删除多余的就好了。
- 偶遇贰
在使用代理的时候,自觉编码没问题,编译出错。且,猝不及防!
出错展示:Ambiguous reference to member 'tableView(_:heightForHeaderInSection:
描述:为实现点击UiTableViewController
中自定义的UITableViewCell
下的UICollectionViewCell
进行跳转的监听。在UITableViewCell
定义了一个协议protocol。
此处错误的原因是,在UITableViewCell(MyFirstSectionCell)
定义了一个协议protocol(MyFirstSectionCellDelagate)
,协议的方法 MyFirstSectionCell 函数名称和 自定义view的MyFirstSectionCell 的函数名称一样导致。
解决方法:修改协议函数名称,避免和自定义view的类名称一样。
Bug(2019-4-28)
我的mac本,配置了vscode
执行react-native环境,和配置了xcode
编译react-native的环境。平时使用终端命令在vscode,多编译执行android平台代码,对于ios都是在xcode中执行。但是为了更方便尝试了都在vscode上进行编译,但是第一次使用终端命令react-native run-ios
竟然出错了!
错误内容:xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
解决方法,在你已经安装了XCode的前提下,在终端输入命令:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
Bug(2019-4-28)
No component found for view with name ARTShape
这个错误来的有点触不及防,经过查找解决办法。得到解决!
当前react-native
使用的版本是 0.59.6 。但是使用脚手架生成的项目,在ios平台并把ARTShape这个添加到项目的依赖中,导致app在执行到使用到ARTShape
的地方就出现了崩溃。
解决方案: 添加 node_modules/react-native/Libraries/ART/ART.xcodeproj
到LIbraries。
然后在从Libraries中的ART.xcodeproj/product
目录下,拖拽libArt.a
到Link Binary With Libraries
中。
重新编译运行即可!
Bug(2019-5-6)
react-native iOS平台 配置顶象无感验证之后,Achive 打包失败。Failed to verify bitcode in DingxiangCaptchaSDK.framework/DingxiangCaptchaSDK: error: Cannot extract bundle
解决方案:将项目的 build Settings -> Build Options -> Enable Bitcode 设置为 no 解决了问题 , 打包成功!