测试测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | 自定义 |
发布最新发布 | 2016年6月 |
由 Siddhant Goyal 维护。
依赖项 | |
AFNetworking | ~> 3 |
JSONModel | ~> 1.2 |
ISO8601 | ~> 0.5 |
沃尔玛是全球最大的零售商,Walmart Open API 提供了访问我们庞大的产品目录的权限,从而使得数字分销伙伴能够从客户推荐中获得可观的联盟收入。
CocoaPods 是 Swift 和 Objective-C Cocoa 项目的依赖关系管理器。您可以使用以下命令安装它
$ gem install cocoapods
构建 WalmartOpenApi 需要 CocoaPods 1.0.0+。
要使用 CocoaPods 将 WalmartOpenApi 集成到您的 Xcode 项目中,请确保在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'MyApp' do
pod 'WalmartOpenApi'
end
如果您正在使用 Swift,请务必添加 use_frameworks! 并将您的目标设置为 iOS 8+
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'WalmartOpenApi'
end
然后,运行以下命令
$ pod install
要开始使用,请在此处注册免费的开发者账户并获取您的 API 密钥![链接]
导入 WalmartOpenApi 头文件。
#include <WalmartOpenApi/WalmartOpenApi.h>
通过创建相应的实例来调用沃尔玛 Open API 的端点。例如,请参阅下面的 ProductLookUpApi
示例。
NSString *itemId = @"itemId_example"; //
NSString *apiKey = @"apiKey_example"; // Your API access key
NSString *lsPublisherId = @"lsPublisherId_example"; // Your Rakuten access key (optional)
NSString *format = @"json"; // Type of response required, (currently only JSON supported)
WMTOAProductLookupApi *apiInstance = [[WMTOAProductLookupApi alloc] init];
// Get real time item status including price and availability
[apiInstance getItemWithItemId:itemId
apiKey:apiKey
lsPublisherId:lsPublisherId
format:format
completionHandler: ^(WMTOAItem* output, NSError* error)) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
导入 WalmartOpenHeader
import WalmartOpenApi
通过创建相应的实例来调用沃尔玛 Open API 的端点。例如,请参阅下面的 ProductLookUpApi
示例。
let itemId = "itemId_example" //
let apiKey = "apiKey_example" // Your API access key
let lsPublisherId = "lsPublisherId_example" // Your Rakuten access key (optional)
let format = "json" // Type of response required, (currently only JSON supported)
let apiInstance = WMTOAProductLookupApi()
apiInstance.getItemWithItemId(itemId, apiKey: apiKey, lsPublisherId: lsPublisherId,
format: format, completionHandler: { (output, error) -> Void in
if (output != nil) {
print(output)
}
if (error != nil) {
print(error)
}
})
如果您在编译时收到有关“在框架模块内部包含非模块头文件”的错误,您可以通过以下方式解决:
将项目目标的CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
标志设置为YES
。此配置设置也可以在Xcode中找到,您的目标的构建设置 > 在框架模块中允许非模块化包含。
有关此问题的更多信息,请参阅Apple开发者论坛:https://forums.developer.apple.com/message/78028
如果相同的头文件既可以通过Header Search Paths(
-I
,-isystem
)访问,又可以通过Framework Search Paths(-F
,-iframework
)访问,即使涉及符号链接,编译器也会出现问题。在这些情况下,建议您优先使用Framework Search Paths。(注意,此无效配置可能由外部系统生成,例如CocoaPods。)
建议在多线程环境中为每个线程创建一个ApiClient实例,以避免任何潜在的问题。
请在此处查看WalmartOpenApi可用的端点的详细文档:这里
访问我们的开发者论坛,给予反馈并与SDK的其他用户建立联系。
@WalmartLabs
更多信息请参阅LICENSE文件。