-
-
Save imosquera/1266199 to your computer and use it in GitHub Desktop.
SocializeSDK iOS Code Snippets part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
[Socialize storeSocializeApiKey:@"your socialize api key" andSecret:@"your socialize secret"]; | |
[Socialize storeFacebookAppId:@"your application id"]; | |
self.window.rootViewController = self.navigationController; | |
[self.window makeKeyAndVisible]; | |
return YES; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[socialize getEntityByKey:@"www.techcrunch.com"]; | |
#pragma mark SocializeServiceDelegate | |
//if the entity does not exist | |
-(void)service:(SocializeService*)service didFail:(NSError*)error{ | |
} | |
// if the entity is found, we can access it at the first index of the array. | |
// The size will always be one when we are trying to get information about an entity. | |
-(void)service:(SocializeService*)service didFetchElements:(NSArray*)dataArray { | |
if ([dataArray count]){ | |
id<SocializeObject> object = [dataArray objectAtIndex:0]; | |
if ([object conformsToProtocol:@protocol(SocializeEntity)]){ | |
// do entity saving here. | |
// All the entity related information can be fetched here ie stats or name. | |
} | |
} | |
} | |
#pragma mark - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)commentsButtonPressed { | |
//create an entity that is unique with your application. | |
NSString *entityUrlString = @"http://www.example.com/object/1234"; | |
SocializeCommentsTableViewController* commentsController = | |
[[[SocializeCommentsTableViewController alloc] initWithNibName:@"SocializeCommentsTableViewController" | |
bundle:nil | |
entryUrlString:entityUrlString] autorelease]; | |
[self.navigationController pushViewController:commentsController animated:YES]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment