链接错误
Undefined symbols
只声明了符号,却未定义符号的具体实现。
分两种情况
1、符号没有具体实现。 2、符号有具体实现,但是链接器并不知道具体实现在哪。
对于第1种情况,需要实现符号定义。
对于第2种情况,我们只有配置好链接就好了。
常见的链接错误情况
libc++
错误形式如下:
Undefined symbols for architecture x86_64: "vtable for __cxxabiv1::__class_type_info", referenced from: typeinfo for FireflyTLV::TLVEntity in FireflyCrypto(TLVPackage.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "std::__1::__shared_weak_count::~__shared_weak_count()", referenced from: std::__1::__shared_ptr_pointer<FireflyTLV::TLVEntity*, std::__1::default_delete<FireflyTLV::TLVEntity>, std::__1::allocator<FireflyTLV::TLVEntity> >::~__shared_ptr_pointer() in FireflyCrypto(TLVPackage.o) std::__1::__shared_ptr_pointer<FireflyTLV::TLVEntity*, std::__1::default_delete<FireflyTLV::TLVEntity>, std::__1::allocator<FireflyTLV::TLVEntity> >::~__shared_ptr_pointer() in FireflyCrypto(TLVPackage.o) "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o)
libz 和 libz2
错误形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
libsqlite3
错误形式如下:
Undefined symbols for architecture x86_64: "_sqlite3_column_bytes", referenced from: -[FMResultSet dataForColumnIndex:] in FMDB(FMResultSet.o) -[FMResultSet dataNoCopyForColumnIndex:] in FMDB(FMResultSet.o) "_sqlite3_column_double", referenced from: -[FMResultSet doubleForColumnIndex:] in FMDB(FMResultSet.o) "_sqlite3_column_int", referenced from: -[FMResultSet intForColumnIndex:] in FMDB(FMResultSet.o) "_sqlite3_column_text", referenced from: -[FMResultSet kvcMagic:] in FMDB(FMResultSet.o) -[FMResultSet stringForColumnIndex:] in FMDB(FMResultSet.o) -[FMResultSet UTF8StringForColumnIndex:] in FMDB(FMResultSet.o) "_sqlite3_column_name", referenced from: -[FMResultSet columnNameToIndexMap] in FMDB(FMResultSet.o) -[FMResultSet kvcMagic:] in FMDB(FMResultSet.o) -[FMResultSet resultDictionary] in FMDB(FMResultSet.o) -[FMResultSet columnNameForIndex:] in FMDB(FMResultSet.o) "_sqlite3_column_count", referenced from: -[FMResultSet columnCount] in FMDB(FMResultSet.o) -[FMResultSet columnNameToIndexMap] in FMDB(FMResultSet.o) -[FMResultSet kvcMagic:] in FMDB(FMResultSet.o) -[FMResultSet resultDictionary] in FMDB(FMResultSet.o) -[FMResultSet stringForColumnIndex:] in FMDB(FMResultSet.o) -[FMResultSet dateForColumnIndex:] in FMDB(FMResultSet.o) -[FMResultSet dataForColumnIndex:] in FMDB(FMResultSet.o) ... "_sqlite3_result_error_code", referenced from: -[FMDatabase resultErrorCode:context:] in FMDB(FMDatabase.o) "_sqlite3_result_error", referenced from: -[FMDatabase resultError:context:] in FMDB(FMDatabase.o) "_sqlite3_result_text", referenced from: -[FMDatabase resultString:context:] in FMDB(FMDatabase.o) "_sqlite3_value_blob", referenced from: -[FMDatabase valueData:] in FMDB(FMDatabase.o) "_sqlite3_result_blob", referenced from: -[FMDatabase resultData:context:] in FMDB(FMDatabase.o) "_sqlite3_value_bytes", referenced from:
AssetsLibrary.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_ALAssetsLibrary", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerTool.o)
AVFoundation.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_AVAssetImageGenerator", referenced from: objc-class-ref in FireflyUI(FireflySimpleCamera.o) "_OBJC_CLASS_$_AVURLAsset", referenced from: objc-class-ref in FireflyUI(FireflySimpleCamera.o)
Photos.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_PHAssetCollectionChangeRequest", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerManager.o) "_OBJC_CLASS_$_PHImageManager", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerManager.o) "_OBJC_CLASS_$_PHAsset", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerManager.o) "_OBJC_CLASS_$_PHAssetCollection", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerManager.o) "_OBJC_CLASS_$_PHFetchOptions", referenced from: objc-class-ref in FireflyUI(FireflyImagePickerManager.o)
CoreMedia.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_CMSampleBufferGetImageBuffer", referenced from: +[FireflyQRCodeScan imageFromSampleBuffer:] in FireflyScanCode(FireflyQRCodeScan.o)
WebKit.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WKUserScript", referenced from: objc-class-ref in FireflyJSBridge(FireflyWKWebView.o) "_OBJC_CLASS_$_WKPreferences", referenced from: objc-class-ref in FireflyJSBridge(FireflyJSWKWebViewController.o)
AddressBook.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_ABPersonCreate", referenced from: ___65+[FireflyJSBridgePhoneContact addPhoneContact:completionHandler:]_block_invoke in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_ABAddressBookCopyArrayOfAllPeople", referenced from: ___65+[FireflyJSBridgePhoneContact addPhoneContact:completionHandler:]_block_invoke in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_ABAddressBookRemoveRecord", referenced from: ___65+[FireflyJSBridgePhoneContact addPhoneContact:completionHandler:]_block_invoke in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonLastNameProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonFirstNameProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) ___65+[FireflyJSBridgePhoneContact addPhoneContact:completionHandler:]_block_invoke in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_ABPersonSetImageData", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonNicknameProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonMiddleNameProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABWorkLabel", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonEmailProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonOrganizationProperty", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_ABRecordCopyValue", referenced from: ___65+[FireflyJSBridgePhoneContact addPhoneContact:completionHandler:]_block_invoke in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonAddressStateKey", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_kABPersonHomePageLabel", referenced from: +[FireflyJSBridgePhoneContact parse:toContactPerson:] in FireflyJSBridge(FireflyJSBridgePhoneContact.o) "_CNCopyCurrentNetworkInfo", referenced from: +[FireflyNetworkReachInfo getWifiName] in FireflyNetwork(FireflyNetworkReachInfo.o)
CoreLocation.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_CLLocationManager", referenced from: objc-class-ref in FireflyUtil(FireflyLocationManager.o) "_kCLLocationAccuracyBest", referenced from: -[FireflyLocationManager startLocation] in FireflyUtil(FireflyLocationManager.o) "_CLLocationCoordinate2DMake", referenced from: _S_FireflyLocationManager_GetCurrentCoordinate in FireflyUtil(FireflyLocationManager.o)
SystemConfiguration.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
0
AdSupport.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
1
CoreTelephony.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
2
QuickLook.framework
错误形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
3
运行错误
unrecognized selector sent to instance
通常,实例instance没有响应selector,也可以说实例instance没有实现方法selector。 其错误栈信息形式如下:
Undefined symbols for architecture x86_64: "_inflate", referenced from: _unzReadCurrentFile in Minizip(unzip.o) "_inflateInit2_", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) "_get_crc_table", referenced from: _unzOpenCurrentFile3 in Minizip(unzip.o) _zipOpenNewFileInZip3 in Minizip(zip.o) "_inflateEnd", referenced from: _unzCloseCurrentFile in Minizip(unzip.o) "_BZ2_bzReadOpen", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o) "_BZ2_bzRead", referenced from: _ff_bs43patch in FireflyUtil(bsdiff43.o)
4
引起这个崩溃的常见情况有两个: 1、在代码中以Catagory
的形式实现了对应方法,编译打包都没有问题,但是运行是没有加载Catagory
方法的符号,导致崩溃。
这种情况,需要在Build Settings -> Linking -> Other Link Flags
添加-ObjC
2、确实没有实现对应的方法。
这种情况,需要实现对应方法。
还没有评论,来说两句吧...