From 04b3af7a22a1188da5dc721bd6cbf36d2a4d460f Mon Sep 17 00:00:00 2001 From: lizhongyi Date: Thu, 15 Jun 2023 19:09:26 +0800 Subject: [PATCH] docs: update uts-ios-cocoapods.md --- docs/plugin/uts-ios-cocoapods.md | 136 ++++++++++++++++--------------- docs/plugin/uts-ios-config.md | 15 ++-- 2 files changed, 74 insertions(+), 77 deletions(-) diff --git a/docs/plugin/uts-ios-cocoapods.md b/docs/plugin/uts-ios-cocoapods.md index b9dbdef08..c337ae673 100644 --- a/docs/plugin/uts-ios-cocoapods.md +++ b/docs/plugin/uts-ios-cocoapods.md @@ -1,71 +1,5 @@ -## uts iOS CocoaPods -本文旨在帮助uts插件开发者和使用者,快速了解pod依赖库使用过程中常见错误处理及CocoaPods的安装方式 - - -## pod依赖库使用过程中常见错误及处理方式说明 - -### 未安装CocoaPods - -错误信息:uni_module [xxxx](iOS)存在pod三方依赖库,请先安装CocoaPods! -说明:出现此错误是因为当前环境没有安装CocoaPods -处理方法: 请参照[详见](https://uniapp.dcloud.net.cn/plugin/uts-ios-cocoapods)安装CocoaPods工具。 - -### 指定的pod库在本地repo仓库找不到索引 - -错误信息:CocoaPods could not find compatible versions for pod "xxx" -报错示例: - -```ts -'Analyzing dependencies\n' + - '[!] CocoaPods could not find compatible versions for pod "HandyJSON":\n' + - ' In Podfile:\n' + - ' HandyJSON (= 2.0.2)\n' + - '\n' + - 'None of your spec sources contain a spec satisfying the dependency: `HandyJSON (= 2.0.2)`.\n' + - '\n' + - 'You have either:\n' + - ' * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n' + - ' * mistyped the name or version.\n' + - ' * not added the source repo that hosts the Podspec to your Podfile.\n', -``` - -说明:出现此错误是因为执行 pod install 时在本地 repo 仓库未找到对应的库索引。 -处理方法: - -- 请首先确保配置的 pod 库 name 正确,配置的 version 不高于 pod 库发行的最高版本号。 -- 在确保配置的前提下,在终端手动执行 pod repo update 命令。(说明:由于pod repo update 较为耗时,为了保证编译速度,避免无必要的 pod repo update, 插件内部只执行了 pod install) - -### pod库下载失败 - -错误信息示例: - -- 示例一 - -```ts -'[!] Error installing Alamofire\n' + -'[!] /usr/bin/git clone https://github.com/Alamofire/Alamofire.git /var/folders/9h/2znqhy813g932mrj_c9f781w0000gn/T/d20230614-22451-49mc32 --template= --single-branch --depth 1 --branch 5.7.1\n' + -'\n' + -"Cloning into '/var/folders/9h/2znqhy813g932mrj_c9f781w0000gn/T/d20230614-22451-49mc32'...\n" + -"fatal: unable to access 'https://github.com/Alamofire/Alamofire.git/': error:02FFF03C:system library:func(4095):Operation timed out\n", -``` - -- 示例二 - -```ts -"[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_8_e_e.txt Response: Couldn't resolve host name\n", -``` - -- 示例三 - -```ts -'[!] CDN: trunk Repo update failed - 75 error(s):' -``` - -说明: 出现此类错误是因为网络超时、不能正常访问 github、或者需要翻墙。 - -处理方式: -- 检查您的网络,确保网络顺畅,且可以正常访问github,某些pod库的下载可能需要翻墙。在网络不好时,请多试几次。 +本文旨在帮助 uts 插件开发者和使用者,快速了解在MAC环境真机运行时 CocoaPods 的安装方法,以及 CocoaPods 使用过程中常见错误处理 ## CocoaPods install @@ -92,6 +26,7 @@ sudo gem install activesupport -v 6.1.7.3 ``` 安装成功后再次执行 sudo gem install cocoapods 安装 CocoaPods. + - 如果执行命令之后报错,说明需要升级 gem 和 ruby ``` @@ -226,3 +161,70 @@ pod repo update ``` pod search Alamofire ``` + + +## pod依赖库使用过程中常见错误及处理方式说明 + +### MAC 环境真机运行 uts 插件时未安装 CocoaPods + +错误信息:uni_module [xxxx](iOS)存在pod三方依赖库,请先安装 CocoaPods! +说明:出现此错误是因为当前环境没有安装 CocoaPods +处理方法: 请参照上述章节描述的方式安装 CocoaPods 工具。 + +### 指定的 pod 库在本地 repo 仓库找不到索引 + +错误信息:CocoaPods could not find compatible versions for pod "xxx" +报错示例: + +```ts +'Analyzing dependencies\n' + + '[!] CocoaPods could not find compatible versions for pod "HandyJSON":\n' + + ' In Podfile:\n' + + ' HandyJSON (= 2.0.2)\n' + + '\n' + + 'None of your spec sources contain a spec satisfying the dependency: `HandyJSON (= 2.0.2)`.\n' + + '\n' + + 'You have either:\n' + + ' * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.\n' + + ' * mistyped the name or version.\n' + + ' * not added the source repo that hosts the Podspec to your Podfile.\n', +``` + +说明:出现此错误是因为执行 pod install 时在本地 repo 仓库未找到对应的库索引。 +处理方法: + +- 请首先确保配置的 pod 库 name 正确,配置的 version 不高于 pod 库发行的最高版本号, 未使用私有仓库 pod 库。 +- 真机运行时在终端手动执行 pod repo update 命令。(说明:由于pod repo update 较为耗时,为了保证编译速度,避免无必要的 pod repo update, 插件内部只执行了 pod install), +- 云打包时请重新打包,或者联系管理员。 + +### pod库下载失败 + +错误信息示例: + +- 示例一 + +```ts +'[!] Error installing Alamofire\n' + +'[!] /usr/bin/git clone https://github.com/Alamofire/Alamofire.git /var/folders/9h/2znqhy813g932mrj_c9f781w0000gn/T/d20230614-22451-49mc32 --template= --single-branch --depth 1 --branch 5.7.1\n' + +'\n' + +"Cloning into '/var/folders/9h/2znqhy813g932mrj_c9f781w0000gn/T/d20230614-22451-49mc32'...\n" + +"fatal: unable to access 'https://github.com/Alamofire/Alamofire.git/': error:02FFF03C:system library:func(4095):Operation timed out\n", +``` + +- 示例二 + +```ts +"[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_8_e_e.txt Response: Couldn't resolve host name\n", +``` + +- 示例三 + +```ts +'[!] CDN: trunk Repo update failed - 75 error(s):' +``` + +说明: 出现此类错误是因为网络超时、不能正常访问 github、或者需要翻墙。 + +处理方式: +- 真机运行:检查您的网络,确保网络顺畅,且可以正常访问github,某些pod库的下载可能需要翻墙。在网络不好时,请多试几次。 +- 云打包:请重新打包,或者联系管理员。 \ No newline at end of file diff --git a/docs/plugin/uts-ios-config.md b/docs/plugin/uts-ios-config.md index c7784d657..8d9ec14d3 100644 --- a/docs/plugin/uts-ios-config.md +++ b/docs/plugin/uts-ios-config.md @@ -7,16 +7,11 @@ uts插件在iOS平台的其它原生配置文件,可以在其中配置依赖 "可选,依赖的系统库(系统库有.framework和.tbd和.dylib类型)" ], "deploymentTarget": "9.0", // 可选,插件支持的最低 iOS 版本 默认:9.0" - "validArchitectures": [ // 可选,支持的 CPU 架构类型 默认:armv7、arm64 - "arm64" // 支持多个值,可取值:"arm64", "armv7" + "validArchitectures": [ // 可选,支持的 CPU 架构类型 默认:arm64 + "arm64" ], - "dependencies-pods": [{ // 可选, 需要依赖的pod库 - "name": "AMap3DMap", - "version": "9.7.0" - }, { - "name": "PayPal", - "version": "0.0.1" - }, { + "dependencies-pods": [ // 可选, 需要依赖的pod库 + { "name": "WechatOpenSDK", "version": "2.0.2" }] @@ -28,7 +23,7 @@ uts插件在iOS平台的其它原生配置文件,可以在其中配置依赖 - deploymentTarget:插件支持的最低 iOS 版本号,此节点为可选项,默认设置为 9.0. + 插件支持的最低版本号应该设置为所有依赖的三方库(包含 framework .a pod )中最低支持版本号中的最高的一个。 + pod 库的最低支持系统版本号可在 pod 库的 spec 文件或者 readme 中查看。 -- validArchitectures:插件支持的 CPU 架构类型,此节点为可选项,默认值为:armv7、arm64。 +- validArchitectures:插件支持的 CPU 架构类型,此节点为可选项,默认值为:arm64。 - dependencies-pods:插件需要依赖的 pod 库 + 把需要依赖的 pod 库相关信息配置在 dependencies-pods 节点下,需要明确指定每个 pod 库的名字 (name) 和版本号 (version),可同时配置多个 pod 依赖库。目前不支持通过 podfile 文件直接设置,也不支持 podfile 文件中除了 name 和 version 之外的其他配置项。 + 为了保证插件的稳定性,避免因未指定 pod 库版本,执行 pod install 之后 pod 库最新版本造成的代码不兼容问题,需要明确指定 pod 库的具体版本。version 字段不可省略,不可为空字符串。 建议将 version 配置为 `"9.7.0"` 这种明确的数字版本号,不建议使用 `~>, >, >=, <, <=` 等带符号的配置。 -- GitLab