10分钟搞定支付宝和微信支付 的 各种填坑

填坑
支付宝填坑是每个接入支付宝必经之路,下面是我接入支付宝遇到的问题汇总,希望大家在接入的路上少一点弯路

问题1. Util/base64.h:63:21: Cannot find interface declaration for ‘NSObject’, superclass of ‘Base64’

问题2.截图告知你什么问题

问题3.Util/openssl_wrapper.m:11:9: ‘rsa.h’ file not found

EB1487E2-FFA9-494B-923D-C5F7CD1AF1FC.png

问题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_string1::char_traits, std::1::allocator >::init(char const, unsigned long)”, referenced from:
CAliSecXURL::encodeURIComponent(CAliSecXBuffer&) in AlipaySDK
“std::1::basic_string1::char_traits, 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)

截图如下,由于公司同时接入支付宝和微信支付,所以导入的库就多了点咯:

问题5.Redefinition of ‘RSA’ as different kind of symbol 多为sdk集成时产生的坑,因为我们公司在集成支付宝之前,有用过RSA加密,导致重名问题

问题6;系统库导入问题
+++++++++++++
symbol(s) not found for architecture arm64

17321E6C-1A33-41D4-9B6E-9E499CCA23C6.png

解决办法
就是导入系统库了

问题7:终于到微信了,接入微信,你就开心了
因为问题太少了,只能感谢下这两个帖子的楼主了
解决办法:
使用微信支付SDK1.5版本的支付demo
微信支付如果遇到跳转只有一个确定请看这里

为了一些懒人懒的去看帖子,简单说,就是微信支付注册放在友盟分享之后就ok了!
代码示例:

问题7:
支付宝要重新生成私钥和公钥,并上传修改公钥 — 为你补充

解决办法:
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 6 收藏 评论

可能感兴趣的话题



直接登录
跳到底部
返回顶部