CloudSight 1.0.4

CloudSight 1.0.4

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
版本最新版本2017年3月

Brad FolkensBrad Folkens 维护。



 
依赖
BFOAuth~> 1.0
RequestUtils~> 1.1
 

Objective-C 的 CloudSight API 库。从 CamFind-iOS 提取。

Podfile

pod "CloudSight", "~> 1.0"

用法

配置实例

CloudSight 库使用 OAuth1 认证方法对 API 进行身份验证。确保设置了您的密钥和密钥。

[CloudSightConnection sharedInstance].consumerKey = @"your-key";
[CloudSightConnection sharedInstance].consumerSecret = @"your-secret";

使用查询对象

使用 API 的最简单方法是使用查询对象来处理您请求/响应的流程。

@interface ViewController ()
@property (nonatomic, retain) CloudSightQuery *query;
@end

- (void)searchWithImage:(UIImage *)image {
    NSString *deviceIdentifier = nil;  // This can be any unique identifier per device, and is optional - we like to use UUIDs
    CLLocation *location = nil; // you can use the CLLocationManager to determine the user's location

    // We recommend sending a JPG image no larger than 1024x1024 and with a 0.7-0.8 compression quality,
    // you can reduce this on a Cellular network to 800x800 at quality = 0.4
    NSData *imageData = UIImageJPEGRepresentation(image, 0.7);

    // Create the actual query object
    self.query = [[CloudSightQuery alloc] initWithImage:imageData
                                             atLocation:focalPoint
                                           withDelegate:self
                                            atPlacemark:location
                                           withDeviceId:deviceIdentifier];

    // Start the query process
    [self.query start];
}

#pragma mark CloudSightQueryDelegate

- (void)cloudSightQueryDidFinishIdentifying:(CloudSightQuery *)query {
    if (query.skipReason != nil) {
        NSLog(@"Skipped: %@", query.skipReason);
    } else {
        NSLog(@"Identified: %@", query.title);
    }
}

- (void)cloudSightQueryDidFail:(CloudSightQuery *)query withError:(NSError *)error {
    NSLog(@"Error: %@", error);
}

示例

有一个可以运行的 Obj-C 示例,您可以通过在 XCode 中打开 Example-objc/CloudSightExample.xcworkspace 来运行。

许可证

CloudSight 在 MIT 许可证下发布。