刚开始集成微信支付就来这样的报错,而且微信支付demo也都问题百出,解决了一个又一个
先说说运行微信SDK demo编译错误的问题,其实很简单:
Undefined symbols for architecture x86_64:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[WXOGCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamPropertySSLSettings", referenced from:
-[WXOGCDAsyncSocket cf_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLPeerName", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamNetworkServiceType", referenced from:
-[WXOGCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLCertificates", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLIsServer", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLAllowsAnyRoot", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLAllowsExpiredRoots", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLValidatesCertificateChain", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLAllowsExpiredCertificates", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
"_kCFStreamSSLLevel", referenced from:
-[WXOGCDAsyncSocket ssl_startTLS] in libWeChatSDK.a(GCDAsyncSocket.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决办法:添加库 CFNetwork.framework libc++.tbd
SDK出现libc++abi.dylib: terminating with uncaught exception of type NSException 的问题: 解决方法
工程文件中选择Build Setting,在"Other Linker Flags"中加入"-Objc -all_load" ,问题就解决了