Integrate the SDK Package for iOS
This topic covers how to easily integrate the iOS SDK package with CocoaPods and by manual operation.
Integrate the SDK Package with CocoaPods
Please follow the steps below to integrate the SDK package with CocoaPods.
- Update the .netrc file:
For security reasons, Antom SDK uses a private CocoaPods source to distribute the pods. To gain access to the private source, you need to update your .netrc file which holds the required credentials. Copy the code snippet below to update your .netrc file.
The .netrc file is located in the ~/.netrc directory, if it does not exist, you need to create a .netrc file. Refer to the .netrc file for more information.
machine globaltech.alipay.com
login antomsdk@aliyun.com
password Admin1234
- Add the private source and dependency to your Podfile:
Antom provides you with multiple integration package options. Use the corresponding code snippet to add CocoaPods private source and dependencies to your Podfile.
- SDK package (Required)
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'
target 'YOUR_TARGET' do
pod 'AMSComponent'
end
- SDK security package (Optional): Enhance security performance and reduce security challenges in the payment process.
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'
target 'YOUR_TARGET' do
pod 'AMSComponent'
pod 'AMSSecurity'
end
- Apple Pay package (Optional): When you need to integrate Apple Pay, use the following code snippet. The Apple Pay package can be used in conjunction with the security package.
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'
target 'YOUR_TARGET' do
pod 'AMSComponent'
pod 'AMSApplePay'
end
- Integrate AlipayCN
Note: Only the EasySafePay supports integration with AlipayCN currently.
Add the URL Schemes configuration to the main project Info.plist file:
Integrate the SDK Package manually
If you are not using CocoaPods integration, you can follow the manual integration method provided by Antom.
- Download the latest SDK package in Alipay Global Partner Developer Center:
Go to Resources > Download Detail > iOS, select the corresponding product package, and click on View the download address of this package to download. Accept the download agreement for the first download.
- Add the frameworks:
Add the following frameworks to your project:
SDK package framework:
- AMSComponent.framework
- AlipayWebView.framework
Add AlipayWebView.framework/IWebContainer.bundle and AMSComponent.framework/AMSComponent.bundle.
- Add -ObjC:
Go to Build Settings > Linking > Other Linker Flags to add -ObjC.
- Integrate AlipayCN
Note: Only the EasySafePay supports integration with AlipayCN currently.
Add the URL Schemes configuration to the main project Info.plist file: