无法使用 Apollo-Client HttpLink 连接到 GraphQL 服务器
Cannot connect to GraphQL server using Apollo-Client HttpLink
运行 在模拟器上。
Error: Network error: Network request failed
at new ApolloError (bundle.umd.js:92)
at Object.error (bundle.umd.js:1323)
at notifySubscription (Observable.js:134)
at onNotify (Observable.js:165)
at SubscriptionObserver.error (Observable.js:224)
at bundle.umd.js:1100
at Set.forEach (<anonymous>)
at Object.error (bundle.umd.js:1099)
at notifySubscription (Observable.js:134)
at onNotify (Observable.js:165)
import ApolloClient, { gql, HttpLink, ApolloLink , concat } from "apollo-boost";
const httpLink = new HttpLink({
uri: 'http://localhost:4000'
});
const client = new ApolloClient({
link: httpLink, //using uri: 'http://localhost:4000' works.
});
"apollo-boost": "^0.4.3",
"react-apollo": "^2.5.8",
"graphql": "^14.4.2",
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Apollo Boost 明确不接受链接。它旨在成为一种快速开始使用 Apollo Client 的方法,而无需下载通常需要的所有包。 Apollo Boost 在后台为您创建所有链接。如果您想自己明确定义它们,migrate to the regular client.
运行 在模拟器上。
Error: Network error: Network request failed
at new ApolloError (bundle.umd.js:92)
at Object.error (bundle.umd.js:1323)
at notifySubscription (Observable.js:134)
at onNotify (Observable.js:165)
at SubscriptionObserver.error (Observable.js:224)
at bundle.umd.js:1100
at Set.forEach (<anonymous>)
at Object.error (bundle.umd.js:1099)
at notifySubscription (Observable.js:134)
at onNotify (Observable.js:165)
import ApolloClient, { gql, HttpLink, ApolloLink , concat } from "apollo-boost";
const httpLink = new HttpLink({
uri: 'http://localhost:4000'
});
const client = new ApolloClient({
link: httpLink, //using uri: 'http://localhost:4000' works.
});
"apollo-boost": "^0.4.3",
"react-apollo": "^2.5.8",
"graphql": "^14.4.2",
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Apollo Boost 明确不接受链接。它旨在成为一种快速开始使用 Apollo Client 的方法,而无需下载通常需要的所有包。 Apollo Boost 在后台为您创建所有链接。如果您想自己明确定义它们,migrate to the regular client.