問題1. Util/base64.h:63:21: Cannot find interface declaration for ‘NSObject’, superclass of ‘Base64’php
解決辦法:html
這是base64.h中沒有加入#import 系統庫文件致使,這個錯誤報錯方法直接想噴它一臉。報錯方式太噁心。c++
問題2.截圖告知你什麼問題微信
解決辦法:網絡
這個問題能夠同上的,心情好,截圖再次說明下,在 openssl_wrapper.h中#import 庫便可app
問題3.Util/openssl_wrapper.m:11:9: ‘rsa.h’ file not founddom
解決辦法:oop
(1)萬年老坑,只要你接入支付寶百分百要遇到的問題,因此習覺得常吧微信支付
(2)在Build setting中搜索search,找到Header Search Paths,添加$(PROJECT_DIR)/openssl和$(PROJECT_DIR) 以下圖:ui
(3)重要問題說三遍,這是網絡找到的到答案後繼續有一樣的坑,本身的解決方案,
Header Search Paths $(PROJECT_DIR)/ali中輸入這個
Framework Search Paths 和 Library Search Paths 繼續是$(inherited) 和 $(PROJECT_DIR)/ali
‘rsa.h’ file not found的解決方案
(4)因爲後期多項目的接入,讓我知道一個算是萬能方法吧,就是始終保持Header Search Paths 和 Library Search Paths 都能找到你導入的openssl的正確路徑便可,已嘗試多遍,是能解決以上問題(求黑)
問題4. 這類錯不少,大概有這些:這些多是庫文件沒有導入,致使的
「_CNCopyCurrentNetworkInfo」, referenced from:
Undefined symbols for architecture x86_64:
"CNCopyCurrentNetworkInfo", referenced from:
-[APayReachability wifiInterface] in AlipaySDK
+[internal_DeviceInfo getSSIDInfo] in AlipaySDK
+[internal_DeviceInfo getNetworkInfo] in AlipaySDK
"_CNCopySupportedInterfaces", referenced from:
-[APayReachability wifiInterface] in AlipaySDK
+[internal_DeviceInfo getSSIDInfo] in AlipaySDK
+[internal_DeviceInfo getNetworkInfo] in AlipaySDK
"_CTRadioAccessTechnologyCDMA1x", referenced from:
-[AliSecXReachability networkStatusForFlags:] in AlipaySDK
"_CTRadioAccessTechnologyEdge", referenced from:
-[AliSecXReachability networkStatusForFlags:] in AlipaySDK
"_CTRadioAccessTechnologyGPRS", referenced from:
-[AliSecXReachability networkStatusForFlags:] in AlipaySDK
"_CTRadioAccessTechnologyLTE", referenced from:
-[AliSecXReachability networkStatusForFlags:] in AlipaySDK
"_OBJC_CLASS$_CMMotionManager", referenced from:
objc-class-ref in AlipaySDK
"OBJC_CLASS$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in AlipaySDK
"SCNetworkReachabilityCreateWithAddress", referenced from:
+[APayReachability reachabilityWithAddress:] in AlipaySDK
+[AliSecXReachability reachabilityWithAddress:] in AlipaySDK
"_SCNetworkReachabilityCreateWithName", referenced from:
+[APayReachability reachabilityWithHostname:] in AlipaySDK
+[AliSecXReachability reachabilityWithHostName:] in AlipaySDK
"_SCNetworkReachabilityGetFlags", referenced from:
-[APayReachability isReachable] in AlipaySDK
-[APayReachability isReachableViaWWAN] in AlipaySDK
-[APayReachability isReachableViaWiFi] in AlipaySDK
-[APayReachability connectionRequired] in AlipaySDK
-[APayReachability isConnectionOnDemand] in AlipaySDK
-[APayReachability isInterventionRequired] in AlipaySDK
-[APayReachability reachabilityFlags] in AlipaySDK
...
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[AliSecXReachability startNotifier] in AlipaySDK
"_SCNetworkReachabilitySetCallback", referenced from:
-[APayReachability startNotifier] in AlipaySDK
-[APayReachability stopNotifier] in AlipaySDK
-[AliSecXReachability startNotifier] in AlipaySDK
"_SCNetworkReachabilitySetDispatchQueue", referenced from:
-[APayReachability startNotifier] in AlipaySDK
-[APayReachability stopNotifier] in AlipaySDK
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[AliSecXReachability stopNotifier] in AlipaySDK
"std::1::basic_string, std::1::allocator >::init(char const, unsigned long)", referenced from:
CAliSecXURL::encodeURIComponent(CAliSecXBuffer&) in AlipaySDK
"std::1::basic_string, std::1::allocator >::reserve(unsigned long)", referenced from:
CAliSecXURL::encodeURIComponent(CAliSecXBuffer&) in AlipaySDK
"std::1::basic_string, std::__1::allocator >::~basic_string()", referenced from:
CAliSecXURL::encodeURIComponent(CAliSecXBuffer&) in AlipaySDK
"std::nothrow", referenced from:
CAliSecXBuffer::CAliSecXBuffer(unsigned long) in AlipaySDK
CAliSecXBuffer::_copy(unsigned char const, unsigned long) in AlipaySDK
CAliSecXBuffer::resize(unsigned long) in AlipaySDK
"std::terminate()", referenced from:
clang_call_terminate in AlipaySDK
"operator delete", referenced from:
CAliSecXBuffer::~CAliSecXBuffer() in AlipaySDK
CAliSecXBuffer::release() in AlipaySDK
CAliSecXBuffer::~CAliSecXBuffer() in AlipaySDK
CAliSecXBuffer::operator=(CAliSecXBuffer const&) in AlipaySDK
CAliSecXBuffer::resize(unsigned long) in AlipaySDK
alisec_crypto_Hex2Bin(CAliSecXBuffer const&) in AlipaySDK
alisec_crypto_Bin2Hex(CAliSecXBuffer const&) in AlipaySDK
...
"operator new", referenced from:
CAliSecXBuffer::CAliSecXBuffer(unsigned long) in AlipaySDK
CAliSecXBuffer::_copy(unsigned char const*, unsigned long) in AlipaySDK
CAliSecXBuffer::resize(unsigned long) in AlipaySDK
"cxa_begin_catch", referenced from:
clang_call_terminate in AlipaySDK
"gxx_personality_v0", referenced from:
+[ASSStorageAccesser saveStorageModel:] in AlipaySDK
+[ASSStorageAccesser loadStorageModelFromKeychain] in AlipaySDK
+[ASSStorageAccesser loadPreviousApdid] in AlipaySDK
+[ASSStorageAccesser getRandomizedID] in AlipaySDK
+[ASSStorageAccesser getNewRadomizedID] in AlipaySDK
+[ASSStorageAccesser loadLastLoginTime] in AlipaySDK
+[ASSStorageAccesser saveCurrentLoginTime:] in AlipaySDK
...
"_deflate", referenced from:
+[ASSCommonUtils gzipData:] in AlipaySDK
+[DTGZipUtil compressGZip:] in AlipaySDK
"_deflateEnd", referenced from:
+[ASSCommonUtils gzipData:] in AlipaySDK
+[DTGZipUtil compressGZip:] in AlipaySDK
"_deflateInit2", referenced from:
+[ASSCommonUtils gzipData:] in AlipaySDK
+[DTGZipUtil compressGZip:] in AlipaySDK
"_kCNNetworkInfoKeyBSSID", referenced from:
+[UIDevice(APEX) networkDic] in AlipaySDK
"_kCNNetworkInfoKeySSID", referenced from:
+[UIDevice(APEX) networkDic] in AlipaySDK
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解決辦法:
這種問題經過在General->Link Framework and Libraiies中添加如下framework解決:
- libz.tbd
- libc++.tbd
- Security.framework
- CoreMotion.Framework
- CFNetwork.framework
- CoreTelephony.framework
- SystemConfiguration.framework
截圖以下,因爲公司同時接入支付寶和微信支付,因此導入的庫就多了點咯:
問題5. Redefinition of 'RSA' as different kind of symbol 多爲sdk集成時產生的坑,由於咱們公司在集成支付寶以前,有用過RSA加密,致使重名問題
解決辦法:
(1)這個問題不是每一個公司均可能遇到的,但遇到也心煩
(2)因爲支付寶中的openssl中的rsa.h文件與RSA加密有重名衝突。改掉公司本身以前導入RSA的命名,若是你牛逼也能夠去改rsa.h中的
問題6. 系統庫導入問題
+++++++++++++
symbol(s) not found for architecture arm64
解決辦法:
就是導入系統庫了
問題7:終於到微信了,接入微信,你就開心了
由於問題太少了,只能感謝下這兩個帖子的樓主了
解決辦法:
爲了一些懶人懶的去看帖子,簡單說,就是微信支付註冊放在友盟分享以後就ok了!
代碼示例:
1 2 3 4 |
|
問題7:拉起支付寶報錯:交易訂單處理失敗,請稍後再試(ALI64)
解決辦法:
從新生成私鑰和公鑰,執行步驟以下個問題
問題8:支付寶要從新生成私鑰和公鑰,並上傳修改公鑰 -- 爲你補充
解決辦法:
RSA密鑰生成命令步驟以下:
(1)先在終端鍵入 openssl
生成RSA私鑰
(2)openssl>genrsa -out rsa_private_key.pem 1024
生成RSA公鑰
(3)openssl>rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
將RSA私鑰轉換成PKCS8格式
(4)openssl>pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt
注意:「>」符號後面的纔是須要輸入的命令。
使用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
生成的文件:
把公鑰上傳到支付寶,而後把pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt 這條命令產生的私鑰用在下面設置中就好
而後設置
1 2 3 4 5 6 7 8 9 10 11 |
|
若有問題,繼續分享咯,總結才能讓問題愈來愈少!