Ad
Shopify GraphQL Using Swift Not Getting Response
in Shopify store front grahpQL getting issue while calling store name
Here is the code for it
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()
But not getting success response
Ad
Answer
You are missing the $ sign inside your code you can check updated code here 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 { $0
.shop { $0
.name()
}
}
let task = client.queryGraphWith(query) { response, error in
if let response = response {
print(response);
}else {
print("Query failed: \(error)")
}
}
task.resume()
Ad
source: stackoverflow.com
Related Questions
- → Function Undefined in Axios promise
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Click to navigate on mobile devices
- → Playing Video - Server is not correctly configured - 12939
- → How to allow api access to android or ios app only(laravel)?
- → Axios array map callback
- → Access the Camera and CameraRoll on Android using React Native?
- → Update React [Native] View on Day Change
- → Shopify iOS SDK - issue converting BuyProductVariant to BuyProduct
- → BigCommerce and shopify API
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → React Native - Differences between Android and IOS
- → What is the difference between React Native and React?
Ad