ScantoSDK 0.3.0

ScantoSDK 0.3.0

raymond 维护。



ScantoSDK 0.3.0

  • 作者:
  • AIQ

aiqsdk-ios

AIQSDK 是用于 AIQ iOS SDK 的 Cocoapod。

完整文档

AIQSDK 完整文档托管于一个 GitHub 页面,您可以通过以下链接访问:https://scan-to.github.io/aiqsdk-ios/

使用 Cocoapods 集成

AIQSDK 使用子规格构建,默认为 AIQApi,这是使用 AIQ API 的 iOS 库。

类似于任何其他 Cocoapod 项目,要使用 AIQ API 对您的 iOS 应用进行操作,您只需要在您的 podfile 中包含 AIQSDK。

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

pod 'AIQSDK'

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

初始化

在您的 App Delegate 中,使用从 AIQ Dashboard Portal 获得的 App ID 和密钥初始化 SDK。

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

通过图片搜索

作为AIQAiq框架的一部分,您可以轻松地使用AIQApiClient调用AIQ平台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
            }
        }
    }];