使用 swift 的 Shopify GraphQL 没有得到响应
Shopify GraphQL using swift not getting response
在 Shopify 店面 graphQL 中调用商店名称时出现问题
这是它的代码
let client: Graph.Client = Graph.Client(shopDomain: shopDomain, apiKey: apiKey, locale: locale)
let query = Storefront.buildQuery {
.shop {
.name()
}
}
let task = client.queryGraphWith(query) { response, error in
if let response = response {
print(response);
}else {
print("Query failed: \(error)")
}
}
task.resume()
但是没有得到成功响应
您的代码中缺少 $ 符号,您可以
在这里检查更新的代码
https://github.com/skyclones/ShopifyMobileApp
let shopDomain = "YOUR STORE NAME"
let apiKey = "YOUR STORE KEY"
let locale = Locale(identifier: "en-US")
let client: Graph.Client = Graph.Client(shopDomain: shopDomain, apiKey: apiKey, locale: locale)
client.cachePolicy = .cacheFirst(expireIn: 3600)
let query = Storefront.buildQuery { [=10=]
.shop { [=10=]
.name()
}
}
let task = client.queryGraphWith(query) { response, error in
if let response = response {
print(response);
}else {
print("Query failed: \(error)")
}
}
task.resume()
在 Shopify 店面 graphQL 中调用商店名称时出现问题
这是它的代码
let client: Graph.Client = Graph.Client(shopDomain: shopDomain, apiKey: apiKey, locale: locale)
let query = Storefront.buildQuery {
.shop {
.name()
}
}
let task = client.queryGraphWith(query) { response, error in
if let response = response {
print(response);
}else {
print("Query failed: \(error)")
}
}
task.resume()
但是没有得到成功响应
您的代码中缺少 $ 符号,您可以 在这里检查更新的代码 https://github.com/skyclones/ShopifyMobileApp
let shopDomain = "YOUR STORE NAME"
let apiKey = "YOUR STORE KEY"
let locale = Locale(identifier: "en-US")
let client: Graph.Client = Graph.Client(shopDomain: shopDomain, apiKey: apiKey, locale: locale)
client.cachePolicy = .cacheFirst(expireIn: 3600)
let query = Storefront.buildQuery { [=10=]
.shop { [=10=]
.name()
}
}
let task = client.queryGraphWith(query) { response, error in
if let response = response {
print(response);
}else {
print("Query failed: \(error)")
}
}
task.resume()