Mobile sdk socialframework-df2012_v3

Post on 01-Nov-2014

643 views 1 download

description

 

Transcript of 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

Agenda

Social Media Integration

Use Cases – Chatter to Twitter/Facebook

High Level Design Steps

iOS v5 vs iOS v6 Social Framework

integration

Demo

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.

The business case for social technologiesThe business case for social technologies

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.

 

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

Tweeting from Chatter to Social Frameworks

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.

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

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

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

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

OAuth Flow - Physical

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/

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"]];

Using iOS v5 and v6 SDKUsing iOS v5 and v6 SDK

Integrating with Social MediaIntegrating with Social Media

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

iOS v5 – Sending Tweet – UI Integration

Check for service availability canSendTweet

Create a view controller

Supply a completion handler

Present modally

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]; }

iOS v5 - Limitations

Limited to Twitter

Only designed for modal presentation

iOS v6 – Extending social media support

Capabilities Offered by iOS v6

Provides SLRequest, which can talk to:

• Facebook

• Twitter

• Sina Weibo (1.0 only)

Provides SLServiceTypes

• SLServiceTypeFacebook;

• SLServiceTypeTwitter;

• SLServiceTypeSinaWeibo

iOS v6 – Social Media Integration Options

Two options

General Social Media ViewController• UIActivityViewController

Targeted Integration• SLComposeViewController

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.

iOS v6 – Social Media Integration

iOS v6 - UIActivityViewController

iOS v6 - SLComposeViewController

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];

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

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...

}

Social Services Documentation Sites

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

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

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

Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker NameSpeaker Name Speaker NameSpeaker Name

Speaker Title,@twittername

Speaker Title,@twittername