Apollo GraphQL iOS

Posted

技术标签:

【中文标题】Apollo GraphQL iOS【英文标题】: 【发布时间】:2018-03-20 16:46:54 【问题描述】:

我在我的 swift3 项目中添加了这个运行脚本

APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"

if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1

cd "$SRCROOT/$TARGET_NAME"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate '/*.graphql' --schema schema.json --output API.swift

当我构建时出现此错误:

find: /Users/userName/Documents/Swift: No such file or directory
find: Apps/appName/appName: No such file or directory
find: /Users/userName/Documents/Swift: No such file or directory
find: Apps/appName/Carthage/Build/ios: No such file or directory
++ exec apollo-codegen generate '/*.graphql' --schema schema.json --output API.swift
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

【问题讨论】:

【参考方案1】:

有以下版本

- Apollo (0.8.0):
    - Apollo/Core (= 0.8.0)
- Apollo/Core (0.8.0)

我必须改变

$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh

到:

$APOLLO_FRAMEWORK_PATH/Resources/check-and-run-apollo-codegen.sh

【讨论】:

以上是关于Apollo GraphQL iOS的主要内容,如果未能解决你的问题,请参考以下文章

(Apollo) GraphQL 合并模式

具有多个 GraphQL 端点的 Apollo

GraphQL - 如何捕获“内部”Apollo/GraphQL 错误 - Java Spring Boot

GraphQL“必须提供查询字符串” graphql-tag react-apollo

GraphQL - “Federations”是普通 Graphql 的事情还是 Apollo 的事情?

Apollo/GraphQL:如何获取嵌套元素?