Skip to content

Instantly share code, notes, and snippets.

View nwg's full-sized avatar

Nathaniel W Griswold nwg

  • Greater Milwaukee Area
View GitHub Profile
@nwg
nwg / Authentication.m
Created December 13, 2011 19:21 — forked from FawadHa1der/Authentication.m
SocializeSDK iOS Code Snippets
// invoke the call
[socialize authenticateWithApiKey:@"YourApiKey" apiSecret:@"YourApiSecret"];
#pragma mark SocializeServiceDelegate implementation
// implement the delegate
-(void)didAuthenticate{
NSLog(@"Authenticated");
}
// if the authentication fails the following method is called
//import the socialize header
#import <Socialize/Socialize.h>
@interface Controller : UIViewController
@property (nonatomic, retain) SocializeActionBar *actionBar;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
self.actionBar = [SocializeActionBar actionBarWithKey:@"http://www.example.com/object/1234" presentModalInController:self];
self.actionBar.noAutoLayout = YES;
self.actionBar.view.frame = CGRectMake(0, 400, 320, SOCIALIZE_ACTION_PANE_HEIGHT)
[self.view addSubview:self.actionBar.view];
}
//import the socialize header
#import <Socialize/Socialize.h>
@interface Controller : UIViewController <SocializeActionBarDelegate>
@property (nonatomic, retain) SocializeActionBar *actionBar;
@end
#import <Socialize/Socialize.h>
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [Socialize handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...
[Socialize setCanLoadEntityBlock:^BOOL(id<SocializeEntity> entity) {
return ![entity.name isEqualToString:@"DeletedEntity"];
}];
}
@nwg
nwg / MyAppDelegate.m
Created January 24, 2012 18:37 — forked from imosquera/MyAppDelegate.m
smart notifications
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Don't handle notifications when in the foreground
if (application.applicationState != UIApplicationStateActive) {
return;
}
// Give Socialize a chance to handle this notification if it needs to
if ([Socialize handleNotification:userInfo]) {
return;
@nwg
nwg / appDelegate.m
Created January 25, 2012 20:03 — forked from imosquera/appDelegate.m
ios socialize sample snippets
//import the socialize header
#import <Socialize/Socialize.h>
#pragma mark
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// set the socialize api key and secret, register your app here: http://www.getsocialize.com/apps/
[Socialize storeConsumerKey:@"SOCIALIZE_CONSUMER_KEY"];
[Socialize storeConsumerSecret:@"SOCIALIZE_CONSUMER_SECRET"];
//your application specific code
SocializeEntity *entity = [[[SocializeEntity alloc] init] autorelease];
entity.key = @"myKey";
entity.name = @"My Name";
entity.meta = @"some meta data about this entity";
[socialize createEntity:entity];
-(void)service:(SocializeService*)service didFail:(NSError*)error{
NSLog(@"%@", error);
}
#if !DEBUG && !TARGET_IPHONE_SIMULATOR
[Socialize registerDeviceToken:deviceToken];
#endif