AIQSDK 0.2.7

AIQSDK 0.2.7

AIQKitraymond 维护。



AIQSDK 0.2.7

  • 作者:
  • AIQ

aiqsdk-ios

AIQSDK 是 AIQ 的 iOS SDK 的 Cocoapod。

完整文档

AIQSDK 的完整文档托管在 GitHub 页面上,您可以通过以下链接访问:https://aiqtech.github.io/aiqsdk-ios/

使用 Cocoapods 集成

AIQSDK 使用 subspecs 构造,其中默认是 AIQApi,它是用于使用 AIQ API 的 iOS 库。

就像使用任何其他 Cocoapod 的项目一样,要为您的 iOS 应用程序使用 AIQ 的 API,您只需要在 podfile 中包含 AIQSDK 即可。

使用 CocoaPods,将以下内容添加到 podfile 中:

pod 'AIQSDK'

运行 pod install 以下载 AIQSDK 并将其安装到您的项目中。AIQSDK 目前没有任何第三方依赖。

初始化

在您的 App Delegate 中,使用从 AIQ 控制台门户 获取的应用 ID 和密钥初始化 SDK。

    #import <AIQApi/AIQApi.h>
    [AIQApi initializeWithAppKey:@"appID" appSecret:@"appSecret"];

使用图片搜索

作为AIQAiq框架的一部分,您可以使用AIQApiClient轻松调用地平线平台的API。

当您已经构建了自己的相机/扫描仪视图时,这特别有用。

    [[AIQApiClient sharedClient] scanWithImage:[UIImage imageWithData:imageData] 
                               withCompletion:^(AIQScanAPIResponse * _Nullable result, NSError * _Nullable error)
    {                  
        // no matches found
        if (error) {
            // handle it
            // display no image found
        } else {

            if (result.payloadUrl)
            {
                NSURL *payloadURL = [NSURL URLWithString:result.payloadUrl];
                // present and load trigger url in your webview controller
            }
        }
    }];

使用URL搜索

如果您有一个想要执行搜索查询的图片URL,可以使用AIQApiClient的scanWithUrl方法。

    [[AIQApiClient sharedClient] scanWithUrl:imageUrl 
                              withCompletion:^(AIQScanAPIResponse * _Nullable result, NSError * _Nullable error)
    {                  
        // no matches found
        if (error) {
            // handle it
            // display no image found
        } else {

            if (result.payloadUrl)
            {
                NSURL *payloadURL = [NSURL URLWithString:result.payloadUrl];
                // present and load trigger url in your webview controller
            }
        }
    }];