/ios-api

the hoccer apis - including a implementations in objective-c, ruby, ...

Primary LanguageObjective-CGNU General Public License v3.0GPL-3.0

Install Hoccer to your project

Install the .framework

  • Obtain an Api Key and the framework from developer.hoccer.com.
  • Add and copy the “Hoccer” directory to your project.
  • Add the YAJLIOS.framework to your Xcode Project.
  • Add following system frameworks:
    • CoreLocation.framework
    • MapKit.framework
    • Security.framework
  • Add -all_load, -ObjC to Other Linker Flags in your Project Build Options.

Sample Usage

Using the linking service api

#import <Hoccer/Hoccer.h>

@interface LinkingViewController : UIViewController <HCLinccerDelegate> {
	HCLinccer *client;
}
	
@end

@implementation LinkingViewController 

- (void)viewDidLoad {
	client = [[HCLinccer alloc] initWithApiKey: @"apikey" secret: @"sharedSecret" sandboxed: YES];
	client.delegate = self;
}

- (IBAction)send: (id)sender {
	NSDictionary *payload = [NSDictionary dictionaryWithObject: @"World" forKey: @"Hello"];
	[client send: payload withMode: HCTransferModeOneToOne];
}

- (IBAction)receive: (id)sender {
	[client receiveWithMode: HCTransferModeOneToOne];
}

#pragma mark -
#pragma mark HCClient Delegate Methods

- (void)linccerDidRegister: (HCLinccer *)aLinccer {
	NSLog(@"ready for transfering data");
}

- (void)linccer: (HCLinccer *)aLinccer didSendData: (NSArray *):data  {
	NSLog(@"successfully send data %@", data);
}

- (void)linccer: (HCLinccer *)aLinccer didReceiveData: (NSArray *)data {
	NSLog(@"received data: %@", data);
}

- (void)linccer: (HCLinccer *)aLinccer didFailWithError: (NSError *)error {
	NSLog(@"failed with error: %@" error);
}

- (void)linccerDidUnregister: (HCLinccer *)aLinccer {
	NSLog(@"unregistered hoccer");
}

@end

If you initialize the linccer with the sandbox option set to YES, you connect against our sandbox server. You should use this for development. For production you must set this value to NO.

See the Example project for more or contact support@hoccer.com…

Using the geostorage api

#import <Hoccer/Hoccer.h>

@interface GeostoreSampleViewController : UIViewController <HCGeoStorageDelegate> {
	HCGeoStorage *geostorage;
}
@end

@implementation GeostoreSampleViewController

- (void)viewDidLoad {
    geostorage = [[HCGeoStorage alloc] initWithApiKey:<your api key> secret:<your secret>];
	geostorage.delegate = self;
    
	[geostorage searchNearby];
}

- (void)geostorage: (HCGeoStorage *)geoStorage didFindItems: (NSArray *)items {
    NSLog(@"items: %@", items);
}

A larger example can be found in the sample folder.