Mobile sdk socialframework-df2012_v3

33
Using Mobile SDK for iOS to build Social Enabled Applications Twitter, Facebook, etc. Samuel Sharaf, Salesforce Mobile Team @ssharaf79

description

 

Transcript of Mobile sdk socialframework-df2012_v3

Page 1: Mobile sdk socialframework-df2012_v3

Using Mobile SDK for iOS to build Social Enabled ApplicationsUsing Mobile SDK for iOS to build Social Enabled ApplicationsTwitter, Facebook, etc.

Samuel Sharaf, Salesforce Mobile Team

@ssharaf79

Page 2: Mobile sdk socialframework-df2012_v3

Agenda

Social Media Integration

Use Cases – Chatter to Twitter/Facebook

High Level Design Steps

iOS v5 vs iOS v6 Social Framework

integration

Demo

Page 3: Mobile sdk socialframework-df2012_v3

Safe harborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Page 4: Mobile sdk socialframework-df2012_v3

The business case for social technologiesThe business case for social technologies

Page 5: Mobile sdk socialframework-df2012_v3

The social economy: Unlocking value and productivity through social technologies

According to an analysis of 4,200 companies by Mckinsey,

social technologies stand to unlock from $900 billion to $1.3

trillion in value

Google, Microsoft, Salesforce, Adobe, Facebook and Oracle

have spent upward of $2.5 billion snatching up social media

tools to add to their enterprise suites.

 

Page 6: Mobile sdk socialframework-df2012_v3

Salesforce Chatter

Ability to tweet feed items and comments which have been

authorized by the owner as ‘tweet-able’.

Example – Marc Benioff message to tweet about Dreamforce for

internal employees

Page 7: Mobile sdk socialframework-df2012_v3

Tweeting from Chatter to Social Frameworks

Page 8: Mobile sdk socialframework-df2012_v3

Example Use Case

Using Mobile SDK integrated with Salesforce Platform to build a

marketing mobile app for advertising agency.

Company has been using CRM and Chatter Desktop and would

like to expand their reach & messaging to millions of users

worldwide.

Page 9: Mobile sdk socialframework-df2012_v3

Architecture & OverviewArchitecture & Overview

Salesforce Mobile SDK for iOS,

Oauth, REST API and iOS SDK

Salesforce Mobile SDK for iOS,

Oauth, REST API and iOS SDK

Page 10: Mobile sdk socialframework-df2012_v3

High Level Architecture Stack

Native Mobile Application (iPhone, iPad)Native Mobile Application (iPhone, iPad)

Salesforce CloudSalesforce Cloud

Rest API

Twitter/Facebook APITwitter/Facebook API

OAuth

OAuth

Page 11: Mobile sdk socialframework-df2012_v3

Get Salesforce Mobile SDK for iOS

Step 1

git clone

https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git

Run ./install.sh under SalesforceMobileSDK-iOS

Further Stepshttp://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_iOS

Page 12: Mobile sdk socialframework-df2012_v3

OAuth Flow – Logical Architecture

Native MobileApp

Native MobileApp

Salesforce Platform

Salesforce Platform

Sends App Credentials

User Logs in – Token sent toCall back

Confirms Token

Send Access Token

Maintain Session withRefresh Token

Page 13: Mobile sdk socialframework-df2012_v3

OAuth Flow - Physical

Page 14: Mobile sdk socialframework-df2012_v3

Salesforce Connect API

• Use Rest based Connect API for interaction with Force.com

• Each Resource in Force.com REST API is a named URI –

accessible using HEAD, GET, POST, PATCH or DELETE.

• Examples:

• Get user feed, followers, following etc.

• Perform a query or search

• Update or delete records

https://na1.salesforce.com/services/data/v25.0/sobjects/

Page 15: Mobile sdk socialframework-df2012_v3

Example of using Chatter REST API

The following code snippet uses the 'me' keyword to retrieve the

current users news feed:

NSString *res_url = [NSString

stringWithFormat:@"%@/services/data/v22.0/chatter/feeds/new

s/me/feed-items", [auth.parameters

objectForKey:@"instance_url"]];

Page 16: Mobile sdk socialframework-df2012_v3

Using iOS v5 and v6 SDKUsing iOS v5 and v6 SDK

Integrating with Social MediaIntegrating with Social Media

Page 17: Mobile sdk socialframework-df2012_v3

iOS v5 Social Media Support

• Starting with iOS v5 Apple provided Twitter Framework built in

the SDK

• TWTweetComposeViewController inherits from UIViewController

and provides a very simple mechanism to tweet

Page 18: Mobile sdk socialframework-df2012_v3

iOS v5 – Sending Tweet – UI Integration

Check for service availability canSendTweet

Create a view controller

Supply a completion handler

Present modally

Page 19: Mobile sdk socialframework-df2012_v3

iOS v5 – Using TWTweetComposeViewController

- (void)tweetThis:(id)sender{ - self.tweetController = [[TWTweetComposeViewController alloc] init];

- [self.tweetController setInitialText:@"Tweeting Tweeting!"];

- [self.tweetController setTitle:@"Tweet Please"];

- [self.tweetController setCompletionHandler:^(TWTweetComposeViewControllerResult result) {

- NSString *output;

- switch (result) {

- case TWTweetComposeViewControllerResultCancelled:

- output = @"Tweet Cancelled";

- break;

- case TWTweetComposeViewControllerResultDone:

- output = @"Tweet Done";

- break;

- default:

break;

- }

- // Dismiss the tweet compose view controller

- [self.navController dismissModalViewControllerAnimated:YES]; }];

- [self.navController presentModalViewController:self.tweetController animated:YES]; }

Page 20: Mobile sdk socialframework-df2012_v3

iOS v5 - Limitations

Limited to Twitter

Only designed for modal presentation

Page 21: Mobile sdk socialframework-df2012_v3

iOS v6 – Extending social media support

Page 22: Mobile sdk socialframework-df2012_v3

Capabilities Offered by iOS v6

Provides SLRequest, which can talk to:

• Facebook

• Twitter

• Sina Weibo (1.0 only)

Provides SLServiceTypes

• SLServiceTypeFacebook;

• SLServiceTypeTwitter;

• SLServiceTypeSinaWeibo

Page 23: Mobile sdk socialframework-df2012_v3

iOS v6 – Social Media Integration Options

Two options

General Social Media ViewController• UIActivityViewController

Targeted Integration• SLComposeViewController

Page 24: Mobile sdk socialframework-df2012_v3

iOS v6 - Social Framework Usage Pattern

A common way to use this framework is:

•Create a network session.

•Get the activity feed for a user.

•Make a new post.

•Set properties on a post, add attachments, etc.

•Publish a post to an activity feed.

Page 25: Mobile sdk socialframework-df2012_v3

iOS v6 – Social Media Integration

Page 26: Mobile sdk socialframework-df2012_v3

iOS v6 - UIActivityViewController

Page 27: Mobile sdk socialframework-df2012_v3

iOS v6 - SLComposeViewController

Page 28: Mobile sdk socialframework-df2012_v3

iOS v6 – Example Facebook UI Integration

SLComposeViewController *facebookPostVC = [SLComposeViewController

composeViewControllerForServiceType:SLServiceTypeFacebook];

[facebookPostVC setInitialText:@”Hello Dreamforce"];

[facebookPostVC addImage:[UIImage imageNamed:@"ge.png"]];

[self.navigationController presentViewController:facebookPostVC

animated:YES completion:nil];

Page 29: Mobile sdk socialframework-df2012_v3

iOS v6 – Facebook Access

Your Mobile AppYour Mobile App Twitter ServerTwitter Server

{ “id” = “12345” “name” = “Samuel Sharaf” “firstname” = “Samuel” “lastname” = “Sharaf” “username” = “ssharaf” “gender” = “male” “locale” = “en_US”}

https://graph.facebook.com/me

Page 30: Mobile sdk socialframework-df2012_v3

Accessing User’s Facebook Profile

NSURL *requestURL = [NSURL URLWithString:@"http://graph.facebook.com/me"];

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook

requestMethod:SLRequestMethodGET

URL: requestURL

parameters:nil];

request.account = self.facebookAccount;

[request performRequestWithHander:^(NSData *data,

NSHTTPURLResponse *response,

NSError *error)] {

// Handle the response here...

}

Page 31: Mobile sdk socialframework-df2012_v3

Social Services Documentation Sites

Facebook https://developers.facebook.com/docs/

Sina Weibo http://open.weibo.com/wiki/

Twitter https://dev.twitter.com/docs

Page 32: Mobile sdk socialframework-df2012_v3

Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker NameSpeaker Name Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker Title,@twittername

Page 33: Mobile sdk socialframework-df2012_v3