GithubHelp home page GithubHelp logo

mrhyh / ios-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hoccer/ios-api

0.0 2.0 0.0 3.54 MB

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

License: GNU General Public License v3.0

Objective-C 94.23% C 5.77%

ios-api's Introduction

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 [email protected]

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.

ios-api's People

Contributors

robertpalmer avatar plaetzchen avatar pavel-mayer avatar ralphhoc avatar patrickjuchli avatar

Watchers

James Cloos avatar 与狼共舞 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.