SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Salesforce Mobile SDK
       ISV Architect, 中嶋 一樹




                              1
Safe Harbor
Safe 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 April 30, 2011. 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.




                                                                                                                                    2
3
3
ネイティブアプリ



           4
iOSネイティブアプリの特徴

• リッチなユーザーインターフェース
• デバイス機能の活用
• App Storeでの配信
• XcodeとObjective Cで開発
• ホーム画面に残る




                         5
Force.comと連携するiOSネイティブアプリのアーキテクチャ

        データベース
          Apex
          API

        リソースサーバ                           認証サーバ

                                             Force.com



                  Salesforce Mobile SDK


                        iOS SDK



                                                         6
Force.comと連携するiOSネイティブアプリのアーキテクチャ

        データベース
          Apex
          API                             ①認証・認可


        リソースサーバ                           認証サーバ

                                               Force.com



                  Salesforce Mobile SDK


                        iOS SDK



                                                           6
Force.comと連携するiOSネイティブアプリのアーキテクチャ

        データベース
          Apex
          API                               ①認証・認可


        リソースサーバ                             認証サーバ

                                                 Force.com

                 ②アクセストークン


                    Salesforce Mobile SDK


                          iOS SDK



                                                             6
Force.comと連携するiOSネイティブアプリのアーキテクチャ

         データベース
              Apex
     ③リクエスト   API                               ①認証・認可


        リソースサーバ                                 認証サーバ

                                                     Force.com

                     ②アクセストークン


                        Salesforce Mobile SDK


                              iOS SDK



                                                                 6
Demo App



           7
Mobile SDKのインストールとプロジェクト作成

 Xcodeのインストール



 githubのレポジトリをクローン(ダウンロード)

 $ git clone https://github.com/forcedotcom/SalesforceMobileSDK-iOS.gt



 インストールスクリプトを実行

 $ cd SalesforceMobileSDK-iOS/
 $ ./install.sh



 Native Force.com REST Appテンプレートからプロジェクトを作成

 *Use Automatic Reference Countingのチェックをはずす




                                                                         8
Mobile SDK Nativeテンプレートの構造

 AppDelegate

     Consumer IDとCallback URLを設定


 RootViewController

     認証後のアプリケーションのメイン画面を制御
     *サンプルアプリではユーザ名を10個取得し、テーブルビューに表示


 SFAuthorizingViewController

     認証画面を制御

 SFNativeRestAppDelegate
     UIApplicationDelegateプロトコルに従い、アプリケーション起動から認証までの挙動を担
     当




                                                           9
SFNativeRestAppDelegate

   didFinishLauchingWithOptions:(NSDictionary *)launchOptions

        setupAuthorizingViewControllerをキック



   setupAuthorizingViewController

        rootViewControllerにSFAuthorizingViewControllerのインスタンスをセットし、アクティブに




   loggedIn

        newRootViewControllerをキックしrootViewControllerにRootViewController(アプリの
        コントローラ)をセットし、アクティブに
        *newRootViewControllerはAppDelegateで実装されている




                                                                               10
RootViewController


 viewDidLoad

        メニューバーのタイトルをセット
        Force.comからユーザー名を10個取得

SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:@"SELECT Name FROM User LIMIT 10"];
[[SFRestAPI sharedInstance] send:request delegate:self];




 didLoadResponse:(id)jsonResponse

        レスポンスをself.datarowsにセット


 cellForRowAtIndexPath:(NSIndexPath *)indexPath

        テーブルのセルをデキューまたは生成し、ユーザー名をセット




                                                                                                           11
UIApplicationDelegate    UIAlertViewDelegate            UIViewController           UITableViewController

                        SFAuthCoodinatorDelegate
                                                                Subclass


                                          SFAuthorizingViewController

                        Protocol


                                   SFNativeRestAppDelegate

                                       Subclass                                         Subclass


                                                  AppDelegate              RootViewController

                                                                               Import

                                                     Import        SFRestAPI            SFRestRequest




                                                                                                           12
CRUD操作

レコード作成

NSString *objectType = @"Contact";
NSDictionary *fields = [@"{FirstName:Kazuki, LastName:Nakajima}" JSONValue];

SFRestRequest *request = [[SFRestAPI sharedInstance]
     requestForCreateWithObjectType:objectType fields:fields];

[[SFRestAPI sharedInstance] send:request delegate:self];




レコード削除
NSString *objectId = @"1234567890";
NSString *objectType = @"Contact";

 SFRestRequest *request = [[SFRestAPI sharedInstance]
     requestForDeleteWithObjectType:objectType objectId:objectId];

[[SFRestAPI sharedInstance] send:request delegate:self];




                                                                               13
ハイブリッドアプリ



            14
iOSハイブリッドアプリの特徴

• Web技術での開発
• デバイス機能を呼び出し可能
• App Storeでの配信
• ホーム画面に残る




                  15
Force.comと連携するiOSハイブリッドアプリのアーキテクチャ

         データベース
              Apex
     ③リクエスト   API                                          ①認証・認可


         リソースサーバ                                           認証サーバ

                                                                Force.com

                     ②アクセストークン

                       Force.com Javascript REST Toolkit


                        Salesforce Mobile SDK

                                  iOS SDK

                                                                            16
Demo App



           17
プロジェクト作成

 Hybrid Force.com Appテンプレートからプロジェクトを作成
 *Use Automatic Reference Countingのチェックをはずす




 wwwフォルダを右クリックして一旦削除する
 ポップアップではRemove Referencesをクリック



 プロジェクトを右クリックしてshow in finderを選択し、wwwフォルダをドラッグ&ド
 ロップでプロジェクトに追加する
 *Copy items into destination group’s folder (if needed)を選択
 *Create folder references for any added foldersを選択


 wwwフォルダが青色であることを確認する




                                                              18
Mobile SDK Hybridテンプレートの構造

 bootconfig.js
      Consumer IDとCallback URL等の設定を記述

 forcetk.js
      Force.com JavaScript REST Toolkit。RESTアクセスのラッパー


 index.html
      アプリケーションのメイン画面

 inline.js
      サンプルアプリの処理

 SalesforceOAuthPlugin.js

      PhoneGapのAPIを利用して認証処理を実装

 phonegap-x.x.x.js
      PhoneGapのAPIを提供



                                                        19
bootconfig.js
  debugMode = true | false;

         logToConsoleメソッドの出力がスクリーンに表示されるかどうか

  remoteAccessConsumerKey = xxx;

         コンシューマ             をセット

  oauthRedirectURI = [xxx]

         コールバックURLをセット

  oauthScopes = ['xxx','xxx'];

         発行されるトークンの権限

  startData = new SFHybridApp.LocalAppStartData(); |
                            new SFHybridApp.RemoteAppStartData("[VFページのパス]");


         コンテンツがローカル管理の場合はLocalAppStartData()をセット
         コンテンツがVisualforce管理の場合はRemoteAppStartData()をセット

  autoRefreshOnForeground = true | false;

         OAuthセッションを自動リフレッシュするかどうか




                                                                                20
index.html

   jQuery(document).ready(function(){}

         devicereadyイベント発生時にonDeviceReady()をキックすることを登録



   onDeviceReady(){}

         SalesforceOAuthPlugin.getAuthCredentials()をキック
         salesforceSessionRefreshイベント発生時にsalesforceSessionRefreshed()をキックすることを登
         録
         reLinkClickHandlers()をキック(サンプルアプリのクリックイベントを登録)

   salesforceSessionRefreshed(){}

         forcetk.Clientのインスタンスを生成し、認証で得られたトークンをセット




                                                                              21
PhongeGap.plist
*ファイルの場所はプロジェクト名 > Supporting Files > PhoneGap.plist



ExternalHosts

      JavaScriptやCSSのライブラリを外部サーバから読み込む場合はドメインを明記する必要がある




                                                          22
Force.com JavaScript REST Toolkit
   インスタンス生成
         var forcetkClient = new forcetk.Client(clientId, loginUrl, proxyUrl);

   トークンセット
      forcetkClient.setSessionToken(sessionId, apiVersion, instanceUrl);


   レコード作成
         forcetkClient.create(objtype, fields, callback, error);


   レコード削除
         forcetkClient.del(objtype, id, callback, error);


   SOQL発行

         forcetkClient.query(soql, callback, error);


   Apex Rest発行

         forcetk.Client.apexrest(path, callback, error, method, payload, retry);


                                                                                   23
PhoneGapで提供される機能

                加速度センサー                                   位置情報
                カメラ                                       プッシュ通知
                コンパス                                      音楽データ
                連絡先                                       マイク
                ストレージ                                     回線


カメラ呼び出しの例

 $j(document).on('tap', '#page_create_survey #button_capture_business_card', function(){
     navigator.camera.getPicture(onCameraSuccess, onCameraFail, { quality: 50,
         destinationType: Camera.DestinationType.DATA_URL
     });
 });



 各APIについて詳しくはhttp://docs.phonegap.com/en/1.6.1/index.htmlを参照


                                                                                           24
ありがとうございました!




               25

Mais conteúdo relacionado

Mais de Salesforce Developers Japan

Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜
Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜
Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜Salesforce Developers Japan
 
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発Salesforce Developers Japan
 
Lightning時代のService Cloud概要とカスタマイズ
Lightning時代のService Cloud概要とカスタマイズLightning時代のService Cloud概要とカスタマイズ
Lightning時代のService Cloud概要とカスタマイズSalesforce Developers Japan
 
Spring '19リリース開発者向け新機能セミナー
Spring '19リリース開発者向け新機能セミナーSpring '19リリース開発者向け新機能セミナー
Spring '19リリース開発者向け新機能セミナーSalesforce Developers Japan
 
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -Salesforce Developers Japan
 
MuleSoft Anypoint Platformのコンセプトとサービス
MuleSoft Anypoint PlatformのコンセプトとサービスMuleSoft Anypoint Platformのコンセプトとサービス
MuleSoft Anypoint PlatformのコンセプトとサービスSalesforce Developers Japan
 
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜Salesforce Developers Japan
 
Lightning時代のレポート ダッシュボード & Flow 最前線
Lightning時代のレポート ダッシュボード & Flow 最前線Lightning時代のレポート ダッシュボード & Flow 最前線
Lightning時代のレポート ダッシュボード & Flow 最前線Salesforce Developers Japan
 
Summer18 開発者向け新機能Webセミナー
Summer18 開発者向け新機能WebセミナーSummer18 開発者向け新機能Webセミナー
Summer18 開発者向け新機能WebセミナーSalesforce Developers Japan
 
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方Salesforce Developers Japan
 
Einsteinvision - object detection を試してみよう
Einsteinvision - object detection を試してみようEinsteinvision - object detection を試してみよう
Einsteinvision - object detection を試してみようSalesforce Developers Japan
 
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)Salesforce Developers Japan
 
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装Salesforce Developers Japan
 

Mais de Salesforce Developers Japan (20)

Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜
Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜
Salesforce 開発者向け最新情報 Web セミナー 〜 TrailheaDX での新発表 & Summer '19 リリース新機能 〜
 
Einstein Next Best Action を試してみよう
Einstein Next Best Action を試してみようEinstein Next Best Action を試してみよう
Einstein Next Best Action を試してみよう
 
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発
Salesforce DXとLightning Web ComponentsでモダンSalesforceアプリ開発
 
Lightning時代のService Cloud概要とカスタマイズ
Lightning時代のService Cloud概要とカスタマイズLightning時代のService Cloud概要とカスタマイズ
Lightning時代のService Cloud概要とカスタマイズ
 
Spring '19リリース開発者向け新機能セミナー
Spring '19リリース開発者向け新機能セミナーSpring '19リリース開発者向け新機能セミナー
Spring '19リリース開発者向け新機能セミナー
 
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -
業務課題の解決に、データ分析・予測結果の活用を - Einstein Discovery / Einstein 予測ビルダーのご紹介 -
 
Einstein analyticsdashboardwebinar
Einstein analyticsdashboardwebinarEinstein analyticsdashboardwebinar
Einstein analyticsdashboardwebinar
 
MuleSoft Anypoint Platformのコンセプトとサービス
MuleSoft Anypoint PlatformのコンセプトとサービスMuleSoft Anypoint Platformのコンセプトとサービス
MuleSoft Anypoint Platformのコンセプトとサービス
 
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜
IoTで成功を収めるための製品と戦略 〜 Salesforce IoT 〜
 
Heroku seminar winter19
Heroku seminar winter19Heroku seminar winter19
Heroku seminar winter19
 
Dreamforce18 update platform
Dreamforce18 update platformDreamforce18 update platform
Dreamforce18 update platform
 
Winter '19 開発者向け新機能
Winter '19 開発者向け新機能Winter '19 開発者向け新機能
Winter '19 開発者向け新機能
 
Lightning時代のレポート ダッシュボード & Flow 最前線
Lightning時代のレポート ダッシュボード & Flow 最前線Lightning時代のレポート ダッシュボード & Flow 最前線
Lightning時代のレポート ダッシュボード & Flow 最前線
 
Summer18 開発者向け新機能Webセミナー
Summer18 開発者向け新機能WebセミナーSummer18 開発者向け新機能Webセミナー
Summer18 開発者向け新機能Webセミナー
 
使ってみよう、Salesforce Big Object!
使ってみよう、Salesforce Big Object!使ってみよう、Salesforce Big Object!
使ってみよう、Salesforce Big Object!
 
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
AIアプリはこう作る!-独自の識別モデル作成も簡単 Einstein Platform Services の使い方
 
Spring '18 開発者向け新機能
Spring '18 開発者向け新機能Spring '18 開発者向け新機能
Spring '18 開発者向け新機能
 
Einsteinvision - object detection を試してみよう
Einsteinvision - object detection を試してみようEinsteinvision - object detection を試してみよう
Einsteinvision - object detection を試してみよう
 
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)
Einstein Analyticsによるユースケース別機能、実現例のご紹介(後編)
 
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装
Apache Kafka on Herokuを活用したイベント駆動アーキテクチャの設計と実装
 

Último

スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000Shota Ito
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directoryosamut
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdffurutsuka
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxAtomu Hidaka
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 

Último (9)

スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdf
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
 

Salesforce mobile SDK Webinar

  • 1. Salesforce Mobile SDK ISV Architect, 中嶋 一樹 1
  • 2. Safe Harbor Safe 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 April 30, 2011. 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. 2
  • 3. 3
  • 4. 3
  • 6. iOSネイティブアプリの特徴 • リッチなユーザーインターフェース • デバイス機能の活用 • App Storeでの配信 • XcodeとObjective Cで開発 • ホーム画面に残る 5
  • 7. Force.comと連携するiOSネイティブアプリのアーキテクチャ データベース Apex API リソースサーバ 認証サーバ Force.com Salesforce Mobile SDK iOS SDK 6
  • 8. Force.comと連携するiOSネイティブアプリのアーキテクチャ データベース Apex API ①認証・認可 リソースサーバ 認証サーバ Force.com Salesforce Mobile SDK iOS SDK 6
  • 9. Force.comと連携するiOSネイティブアプリのアーキテクチャ データベース Apex API ①認証・認可 リソースサーバ 認証サーバ Force.com ②アクセストークン Salesforce Mobile SDK iOS SDK 6
  • 10. Force.comと連携するiOSネイティブアプリのアーキテクチャ データベース Apex ③リクエスト API ①認証・認可 リソースサーバ 認証サーバ Force.com ②アクセストークン Salesforce Mobile SDK iOS SDK 6
  • 11. Demo App 7
  • 12. Mobile SDKのインストールとプロジェクト作成 Xcodeのインストール githubのレポジトリをクローン(ダウンロード) $ git clone https://github.com/forcedotcom/SalesforceMobileSDK-iOS.gt インストールスクリプトを実行 $ cd SalesforceMobileSDK-iOS/ $ ./install.sh Native Force.com REST Appテンプレートからプロジェクトを作成 *Use Automatic Reference Countingのチェックをはずす 8
  • 13. Mobile SDK Nativeテンプレートの構造 AppDelegate Consumer IDとCallback URLを設定 RootViewController 認証後のアプリケーションのメイン画面を制御 *サンプルアプリではユーザ名を10個取得し、テーブルビューに表示 SFAuthorizingViewController 認証画面を制御 SFNativeRestAppDelegate UIApplicationDelegateプロトコルに従い、アプリケーション起動から認証までの挙動を担 当 9
  • 14. SFNativeRestAppDelegate didFinishLauchingWithOptions:(NSDictionary *)launchOptions setupAuthorizingViewControllerをキック setupAuthorizingViewController rootViewControllerにSFAuthorizingViewControllerのインスタンスをセットし、アクティブに loggedIn newRootViewControllerをキックしrootViewControllerにRootViewController(アプリの コントローラ)をセットし、アクティブに *newRootViewControllerはAppDelegateで実装されている 10
  • 15. RootViewController viewDidLoad メニューバーのタイトルをセット Force.comからユーザー名を10個取得 SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:@"SELECT Name FROM User LIMIT 10"]; [[SFRestAPI sharedInstance] send:request delegate:self]; didLoadResponse:(id)jsonResponse レスポンスをself.datarowsにセット cellForRowAtIndexPath:(NSIndexPath *)indexPath テーブルのセルをデキューまたは生成し、ユーザー名をセット 11
  • 16. UIApplicationDelegate UIAlertViewDelegate UIViewController UITableViewController SFAuthCoodinatorDelegate Subclass SFAuthorizingViewController Protocol SFNativeRestAppDelegate Subclass Subclass AppDelegate RootViewController Import Import SFRestAPI SFRestRequest 12
  • 17. CRUD操作 レコード作成 NSString *objectType = @"Contact"; NSDictionary *fields = [@"{FirstName:Kazuki, LastName:Nakajima}" JSONValue]; SFRestRequest *request = [[SFRestAPI sharedInstance] requestForCreateWithObjectType:objectType fields:fields]; [[SFRestAPI sharedInstance] send:request delegate:self]; レコード削除 NSString *objectId = @"1234567890"; NSString *objectType = @"Contact"; SFRestRequest *request = [[SFRestAPI sharedInstance] requestForDeleteWithObjectType:objectType objectId:objectId]; [[SFRestAPI sharedInstance] send:request delegate:self]; 13
  • 20. Force.comと連携するiOSハイブリッドアプリのアーキテクチャ データベース Apex ③リクエスト API ①認証・認可 リソースサーバ 認証サーバ Force.com ②アクセストークン Force.com Javascript REST Toolkit Salesforce Mobile SDK iOS SDK 16
  • 21. Demo App 17
  • 22. プロジェクト作成 Hybrid Force.com Appテンプレートからプロジェクトを作成 *Use Automatic Reference Countingのチェックをはずす wwwフォルダを右クリックして一旦削除する ポップアップではRemove Referencesをクリック プロジェクトを右クリックしてshow in finderを選択し、wwwフォルダをドラッグ&ド ロップでプロジェクトに追加する *Copy items into destination group’s folder (if needed)を選択 *Create folder references for any added foldersを選択 wwwフォルダが青色であることを確認する 18
  • 23. Mobile SDK Hybridテンプレートの構造 bootconfig.js Consumer IDとCallback URL等の設定を記述 forcetk.js Force.com JavaScript REST Toolkit。RESTアクセスのラッパー index.html アプリケーションのメイン画面 inline.js サンプルアプリの処理 SalesforceOAuthPlugin.js PhoneGapのAPIを利用して認証処理を実装 phonegap-x.x.x.js PhoneGapのAPIを提供 19
  • 24. bootconfig.js debugMode = true | false; logToConsoleメソッドの出力がスクリーンに表示されるかどうか remoteAccessConsumerKey = xxx; コンシューマ をセット oauthRedirectURI = [xxx] コールバックURLをセット oauthScopes = ['xxx','xxx']; 発行されるトークンの権限 startData = new SFHybridApp.LocalAppStartData(); | new SFHybridApp.RemoteAppStartData("[VFページのパス]"); コンテンツがローカル管理の場合はLocalAppStartData()をセット コンテンツがVisualforce管理の場合はRemoteAppStartData()をセット autoRefreshOnForeground = true | false; OAuthセッションを自動リフレッシュするかどうか 20
  • 25. index.html jQuery(document).ready(function(){} devicereadyイベント発生時にonDeviceReady()をキックすることを登録 onDeviceReady(){} SalesforceOAuthPlugin.getAuthCredentials()をキック salesforceSessionRefreshイベント発生時にsalesforceSessionRefreshed()をキックすることを登 録 reLinkClickHandlers()をキック(サンプルアプリのクリックイベントを登録) salesforceSessionRefreshed(){} forcetk.Clientのインスタンスを生成し、認証で得られたトークンをセット 21
  • 26. PhongeGap.plist *ファイルの場所はプロジェクト名 > Supporting Files > PhoneGap.plist ExternalHosts JavaScriptやCSSのライブラリを外部サーバから読み込む場合はドメインを明記する必要がある 22
  • 27. Force.com JavaScript REST Toolkit インスタンス生成 var forcetkClient = new forcetk.Client(clientId, loginUrl, proxyUrl); トークンセット forcetkClient.setSessionToken(sessionId, apiVersion, instanceUrl); レコード作成 forcetkClient.create(objtype, fields, callback, error); レコード削除 forcetkClient.del(objtype, id, callback, error); SOQL発行 forcetkClient.query(soql, callback, error); Apex Rest発行 forcetk.Client.apexrest(path, callback, error, method, payload, retry); 23
  • 28. PhoneGapで提供される機能 加速度センサー 位置情報 カメラ プッシュ通知 コンパス 音楽データ 連絡先 マイク ストレージ 回線 カメラ呼び出しの例 $j(document).on('tap', '#page_create_survey #button_capture_business_card', function(){ navigator.camera.getPicture(onCameraSuccess, onCameraFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL }); }); 各APIについて詳しくはhttp://docs.phonegap.com/en/1.6.1/index.htmlを参照 24