Troubleshooting CocoaPods CDN Source

To integrate the IAPMiniProgram SDK, you need to set up your .netrc file correctly; otherwise, an error can occur when you run the pos install command.

Follow the steps below to troubleshoot the issue.

Step 1: Remove CocoaPods cache

To ensure that the latest CDN source is used, you need to remove the CocoaPods cache from the local disk. Take the following steps:

  1. Go to the ~/.cocoapods/repo directory and remove the folder that is prefixed with i-v1-file-common-. This folder contains the metadata and the .podspec file of CocoaPods.
  2. Run the command below to remove the CocoaPods cache.
copy
pod cache clean IAPMiniProgram --all; 

Step 2: Update your CocoaPods

The required version for CocoaPods is 1.10.0 or higher. Run the command below to check the version of your CocoaPods. Update your CocoaPods if its version is lower than the required version.

copy
pod --version

Step 3: Set up the .netrc file correctly

Ensure that the .netrc file is set up correctly with the following steps:

  1. Run the command below to verify if the .netrc file exists in the $HOME directory.
copy
cd ~; ls .netrc
  1. Ensure that the .netrc file contains credentials for our server as shown in Credentials.
  2. Run the command below to download the CocoaPods-version.yml file again.
copy
curl --netrc http://globaltech.alipay.com/api/v1/file/common/2017062215370883/minisdk/CocoaPods-version.yml

If the .netrc file works correctly, the response 301 is returned as below.

image.png

Step 4: Use Charles to check requests

After the steps above, run the pod install command again. If successful, then the issue is solved; otherwise, use Charles to record the CLI requests for further analysis.

Open your Charles beforehand and assume the monitoring port of Charles is 8888 (Charles' default port). Try the command below:

copy
ALL_PROXY=http://localhost:8888 pod install

With the command above, Charles can record the CLI requests. Export the records and send them to the Solution Architect for help.