https://github.com/nextfaze/iqkit-ios
iQNECT Kit for iOS
https://github.com/nextfaze/iqkit-ios
Last synced: over 1 year ago
JSON representation
iQNECT Kit for iOS
- Host: GitHub
- URL: https://github.com/nextfaze/iqkit-ios
- Owner: NextFaze
- Created: 2015-05-07T06:02:38.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-06T05:18:45.000Z (about 9 years ago)
- Last Synced: 2025-02-01T08:48:46.725Z (over 1 year ago)
- Language: C++
- Size: 46 MB
- Stars: 0
- Watchers: 22
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
iQKit iOS SDK
-------------
The iQKit iOS SDK gives you access to the powerful iQNECT Vision Search platform
to integrate into your iOS app.
Installation
------------
#### With CocoaPods
Using [CocoaPods](https://cocoapods.org), add to your podfile:
```
pod 'iQKit'
```
Run `pod install` to download the SDK and install it into your project, along with the SDK's dependencies.
Initialization
---------------
#### Required
In your App Delegate, initialise the SDK with the App ID and secret you obtained from the [iQNECT Developer Portal](http://developer.iqnect.org):
```objc
#import "iQKit.h"
```
```objc
[iQKit setAppID:@"APP-ID"
andAppSecret:@"APP-SECRET"];
```
#### Optional
For best results, report some further information about the user:
```objc
[iQKit setUserAge:@(42)];
[iQKit setUserGender:@"f"];
```
The age and gender can be updated at anytime with these functions.
Usage
-----
#### Vision Search
To initiate a vision search, add the following code to an appropriate view controller:
```objc
iQScannerViewController *scannerViewController = [[iQScannerViewController alloc] init];
scannerViewController.delegate = self;
[self presentViewController:scannerViewController animated:NO completion:nil];
```
When the search is complete, you will get a callback via the `iQScannerViewControllerDelegate` protocol:
```objc
- (void)scannerViewController:(iQScannerViewController *)scannerViewController didLoadSearchResponse:(iQAPISearchResponse *)searchResponse
{
[self dismissViewControllerAnimated:YES completion:^{
NSLog(@"Payload URL: %@", searchResponse.payload);
}];
}
```
In the callback, the `iQAPISearchResponse` object has a `payload` property which is the URL returned by the search. Use this URL, typically to load in a web view or to open the iQNECT app.
#### Image Search
This is the same as the Keyword search, except the parameter is of type `UIImage`.
```objc
[[iQAPISearchRequest requestWithImage:image] runWithCompletionHandler:^(iQAPISearchResponse *response) {
NSLog(@"Payload: %@", response.payload);
}];
```