LoginSignup
9
9

More than 5 years have passed since last update.

DeployGate iOS SDKをTitanium Mobileで使う方法

Posted at

2014/4/23にmixiからリリースされたdeploygate ios sdkをtitanium mobileから使えるようにするモジュールを作ってみました

git repos

主な機能

  1. リモートログ出力
  2. deploygateユーザー認証
  3. アップデート通知

deploygate ios sdkが提供する機能のほぼ全てを使うことができます!

使い方

  1. deploygate ios sdkを手に入れる https://deploygate.com/docs/ios_sdk
  2. TiDeploygateをチェックアウトし、ルートディレクトリにある ti.deploygate-iphone-0.1.zip の中にある module.xcconfig のframework参照先を書き換える OTHER_LDFLAGS=$(inherited) -framework DeployGateSDK -F"[ここをdeploygate ios sdkがある場所に書き換える]"
  3. ti.deploygate-iphone-0.1.zipをプロジェクトにインポートする
  4. ユーザー認証を使う場合は プロジェクトの Info.plist に deploygateが指定するurl schemeを追加してください

サンプル

  • tiapp.xml
    
    <modules>
        ..................
        <module version="0.1" platform="iphone">ti.deploygate</module>
    </modules>
    
  • Info.plist
    
    ........
    <key>CFBundleURLSchemes</key>
    <array>
        <string>..............</string>
        <string>[deploygateが指定するurlスキーマをいれる]</string>
    </array>
    ........
    
  • js(クラシックスタイル)

    var TiDeploygate = require('ti.deploygate');
    var win = Ti.UI.createWindow({backgroundColor:'white'});
    var label = Ti.UI.createLabel({
            text: 'ti.deploygate',
            width: Ti.UI.SIZE,
            height: Ti.UI.SIZE
    });
    win.add(label);
    win.open();
    win.addEventListener('open', function () {
        // authorとkeyとユーザー認証ありなし(trueだとユーザー認証あり)を指定する
        TiDeploygate.setup("[author]", "[key]", true);
    });
    
    Ti.App.addEventListener('resume', function (e) {
        var args = Ti.App.getArguments();
        if(args&&args.url){
            // ユーザー認証ありの場合ここにくる
            TiDeploygate.recieveURLScheme(args.url);
            TiDeploygate.remoteLog("log to deploygate");
        }
    });
    

実はちゃんと検証してません><

が、動くはずです( ̄ー ̄)

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9