因專案要求更新SDK到最新版本,昨天跟新SDK到最新版本之後編譯執行專案只有報錯
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PayResp", referenced from:
objc-class-ref in PublicPayManager.o
"_OBJC_CLASS_$_PayReq", referenced from:
objc-class-ref in PublicPayManager.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
或者是
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_PayResp", referenced from:
objc-class-ref in PublicPayManager.o
"_OBJC_CLASS_$_PayReq", referenced from:
objc-class-ref in PublicPayManager.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
複製程式碼
之後查詢了各種方法還是無法解決該問題,在這兩種錯之間徘徊,最後查詢了原因是更新ShareSDK的問題。 因專案本身有微信支付和支付寶支付,自己已經單獨整合了一個關於微信APP支付的SDK,而ShareSDK從4.0.4之後更新cocopods的Podfile 檔案中的地址 ShareSDK cocopods整合 更換成了:
pod 'mob_sharesdk'
# UI模組(非必須,需要用到ShareSDK提供的分享選單欄和分享編輯頁面需要以下1行)
pod 'mob_sharesdk/ShareSDKUI'
# 平臺SDK模組(對照一下平臺,需要的加上。如果只需要QQ、微信、新浪微博,只需要以下3行)
pod 'mob_sharesdk/ShareSDKPlatforms/QQ'
pod 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'
pod 'mob_sharesdk/ShareSDKPlatforms/WeChat' //(微信sdk不帶支付的命令)
# pod 'mob_sharesdk/ShareSDKPlatforms/WeChatFull' //(微信sdk帶支付的命令,和上面不帶支付的不能共存,只能選擇一個)
# ShareSDKPlatforms模組其他平臺,按需新增
# 如果需要的平臺沒有對應的平臺語句,有2種情況——1、不需要新增這個平臺的語句,如Twitter就是這個情況。2、ShareSDK暫時不支援此平臺。
pod 'mob_sharesdk/ShareSDKPlatforms/RenRen'
pod 'mob_sharesdk/ShareSDKPlatforms/AliPaySocial'
pod 'mob_sharesdk/ShareSDKPlatforms/Kakao'
pod 'mob_sharesdk/ShareSDKPlatforms/Yixin'
pod 'mob_sharesdk/ShareSDKPlatforms/Facebook'
pod 'mob_sharesdk/ShareSDKPlatforms/Copy'
pod 'mob_sharesdk/ShareSDKPlatforms/Evernote'
pod 'mob_sharesdk/ShareSDKPlatforms/GooglePlus'
pod 'mob_sharesdk/ShareSDKPlatforms/Instagram'
pod 'mob_sharesdk/ShareSDKPlatforms/Instapaper'
pod 'mob_sharesdk/ShareSDKPlatforms/Line'
pod 'mob_sharesdk/ShareSDKPlatforms/Mail'
pod 'mob_sharesdk/ShareSDKPlatforms/SMS'
pod 'mob_sharesdk/ShareSDKPlatforms/WhatsApp'
pod 'mob_sharesdk/ShareSDKPlatforms/MeiPai'
pod 'mob_sharesdk/ShareSDKPlatforms/DingTalk'
pod 'mob_sharesdk/ShareSDKPlatforms/YouTube'
pod 'mob_sharesdk/ShareSDKPlatforms/Twitter'
pod 'mob_sharesdk/ShareSDKPlatforms/Dropbox'
# 使用配置檔案分享模組(非必需)
pod 'mob_sharesdk/ShareSDKConfigFile'
# 擴充套件模組(在呼叫可以彈出我們UI分享方法的時候是必需的)
pod 'mob_sharesdk/ShareSDKExtension'
複製程式碼
關於微信的SDK他給了兩個一個是
帶有支付的SDK
一個是沒有帶有支付的SDK
無論整合那個都和自己整合的微信支付的SDK有衝突,造成錯誤。後來問詢了Mob的技術支援才知道要是用他們的微信分享的SDK,就不能再自己整合微信SDK,只能是刪除自己整合的微信支付SDK了。
解決辦法:更新ShareSDK4.0.4之後版本時,並且本身專案有微信支付;直接匯入ShareSDK帶有支付的微信SDK,刪除自己本身專案整合的SDK。