支付寶開放平臺的demo地址:https://docs.open.alipay.com/54/104509/
我在集成支付寶SDK的時候遇到兩個問題:
第一個問題:rsa.h頭文件找不到
解決辦法:在building settings里搜索Header Search Paths 添加文件所在路徑?$(SRCROOT)/項目名/文件名
第二個問題:
Undefined symbols for architecture arm64:
? "_EVP_DecodeBlock", referenced from:
? ? ? _dataFromBase64String in openssl_wrapper.o
? "_BIO_free_all", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
? "_PEM_read_bio_RSA_PUBKEY", referenced from:
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
? "_RSA_verify", referenced from:
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
? "_BIO_new", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
? "_EVP_EncodeBlock", referenced from:
? ? ? _base64StringFromData in openssl_wrapper.o
? "_PEM_read_bio_RSAPrivateKey", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? "_RSA_check_key", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? "_SHA1", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
?? ? (maybe you meant: __Z24alisec_crypto_SHA1_blockP26alisec_crypto_shastate_st_Pmi)
? "_RSA_sign", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? "_BIO_ctrl", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
? "_BIO_s_file", referenced from:
? ? ? _rsa_sign_with_private_key_pem in openssl_wrapper.o
? ? ? _rsa_verify_with_public_key_pem in openssl_wrapper.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
這是缺少libcrypto.a和libssl.a文件引起的怕敬,這兩個文件在支付寶的demo中都有揣炕,添加進項目即可。