在模拟器上运行。
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>
答案 0 :(得分:1)
Apollo Boost明确不接受链接。这是一种无需下载通常需要的所有软件包即可快速开始使用Apollo Client的方法。 Apollo Boost可以在后台为您创建所有链接。如果您想自己明确定义它们,请migrate to the regular client。