You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2013/01/02 23:25:38 UTC
[15/16] docs commit: Update and translate files related to
getting-started, plugin-development, upgrading, and whitelist
Update and translate files related to getting-started, plugin-development, upgrading, and whitelist
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/94c825f6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/94c825f6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/94c825f6
Branch: refs/heads/master
Commit: 94c825f61182b21c5238cd93714c6a5d77c924a0
Parents: 0cf828b
Author: Keiko Oda <ke...@gmail.com>
Authored: Wed Jan 2 00:14:57 2013 -0800
Committer: Keiko Oda <ke...@gmail.com>
Committed: Wed Jan 2 00:14:57 2013 -0800
----------------------------------------------------------------------
docs/jp/2.1.0/guide/getting-started/tizen/index.md | 108 +++++++++
.../guide/plugin-development/blackberry/index.md | 6 +-
docs/jp/2.1.0/guide/plugin-development/index.md | 1 +
.../jp/2.1.0/guide/plugin-development/ios/index.md | 60 ++++--
.../2.1.0/guide/plugin-development/tizen/index.md | 23 ++
.../plugin-development/windows-phone/index.md | 171 ++++++++++++++-
docs/jp/2.1.0/guide/upgrading/android/index.md | 10 +
docs/jp/2.1.0/guide/upgrading/index.md | 1 +
docs/jp/2.1.0/guide/upgrading/ios/index.md | 26 ++-
docs/jp/2.1.0/guide/upgrading/tizen/index.md | 23 ++
docs/jp/2.1.0/guide/upgrading/webos/index.md | 23 +--
docs/jp/2.1.0/guide/whitelist/index.md | 32 +++-
12 files changed, 437 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/getting-started/tizen/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/getting-started/tizen/index.md b/docs/jp/2.1.0/guide/getting-started/tizen/index.md
new file mode 100644
index 0000000..c682eea
--- /dev/null
+++ b/docs/jp/2.1.0/guide/getting-started/tizen/index.md
@@ -0,0 +1,108 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+---
+
+Getting Started with Tizen
+=========================
+
+このガイドは、 Cordova のための開発環境セットアップ方法、またシンプルなアプリの動かし方を解説します。 Cordova は以前は PhoneGap と呼ばれていたため、いくつかのサイトは PhoneGap という名前をまだ使用しています。
+
+1. 必要なもの
+---------------
+
+- Linux Ubuntu 10.04/10.10/11.04/11.10 32-bit, Windows XP SP3/7 32-bit.
+
+2. SDK と Cordova のインストール
+-------------------------
+
+- [Tizen SDK](https://developer.tizen.org/sdk) のダウンロードとインストール
+- [Cordova](http://phonegap.com/download) の最新版をダウンロードし解凍します。これから tizen ディレクトリと一緒に作業を進めます
+- (オプション) Tizen の Cordova テンプレートプロジェクトをインストール: copy the `/templates` ディレクトリの中身を Tizen Eclipse IDE の web templates ディレクトリにコピーします (例: `/home/my_username/tizen-sdk/IDE/Templates/web`)
+
+3. 新規プロジェクトの作成
+--------------------
+
+- **方法 #1: Cordova Tizen プロジェクトサンプルのインポート**
+ - Tizen Eclipse IDE を起動します
+ - **File** -> **Import** -> **Tizen Web Project** を選択します
+
+ ![](img/guide/getting-started/tizen/import_project.png)
+
+ - **Next** をクリックします
+ - **Select root directory** がチェックされていることを確認します
+ - **Copy projects into workspace** がチェックされていることを確認します
+ - **Browse** をクリックします
+ - Cordova Tizen の "samples" プロジェクトディレクトリのうちの一つ (例: `/cordova-basic`) を Browse し、選択します
+
+ ![](img/guide/getting-started/tizen/import_widget.png)
+
+ - **Finish** をクリックします
+
+ ![](img/guide/getting-started/tizen/project_explorer.png)
+
+ - これで、プロジェクトはインポートされ **Project Explorer** ビューに表示されます
+
+- **方法 #2: Tizen Eclipse IDE の Cordova Tizen プロジェクトテンプレートの使用**
+ - Tizen Eclipse IDE を起動します
+ - **File** -> **New** -> **Tizen Web Project** を選択します
+ - 項目 **User Template** と **User defined** を選択します
+ - Tizen Cordova template のうちの一つ (e.g: **CordovaBasicTemplate**) を選択します
+ - **Project name** とその **Location** を入力します
+
+ ![](img/guide/getting-started/tizen/project_template.png)
+
+ - **Finish** をクリックします
+
+ ![](img/guide/getting-started/tizen/project_explorer.png)
+
+ - これで、プロジェクトは作成され **Project Explorer** ビューに表示されます
+
+4. Hello World の作成
+--------------
+- プロジェクトのビルド:
+
+ - **Project Explorer** ビューの中のプロジェクトを **右クリック** して **Build Project** を選択します
+
+ ![](img/guide/getting-started/tizen/build_project.png)
+
+ - プロジェクトのルートディレクトリに、ウィジェットパッケージが生成されているはずです (例: `cordova-basic.wgt`)
+
+ - **注意** Tizen Cordova プロジェクトで提供されているサンプルは、基本的な hello world アプリケーションではありません。それらは、 Battery Cordova API のシンプルな使用例です。
+
+
+5A. シミュレーターへのデプロイ
+-----------------------
+
+- **Project Explorer** ビューの中のプロジェクトを **右クリック** して **Run As** と **Tizen Web Simulator Application** を選択します
+
+ ![](img/guide/getting-started/tizen/runas_web_sim_app.png)
+
+5B. デバイス/エミュレーターのデプロイ
+--------------------
+
+- デバイスが正常に起動/接続/設定されていることを確認 ("Date and Time" 設定は正しく設定されている必要があります) します
+- **Connection Explorer** ビューでアプリケーションのデプロイ先を選択します (**Window** Menu -> **Show View** -> **Connection Explorer** を選択)
+
+ ![](img/guide/getting-started/tizen/connection_explorer.png)
+
+- **Project Explorer** ビューの中のプロジェクトを **右クリック** して **Run As** と **Tizen Web Application** を選択します
+
+ ![](img/guide/getting-started/tizen/runas_web_app.png)
+
+終了
+-----
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/plugin-development/blackberry/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/plugin-development/blackberry/index.md b/docs/jp/2.1.0/guide/plugin-development/blackberry/index.md
index d92c90c..11f4481 100644
--- a/docs/jp/2.1.0/guide/plugin-development/blackberry/index.md
+++ b/docs/jp/2.1.0/guide/plugin-development/blackberry/index.md
@@ -80,7 +80,6 @@ cordova.exec へのすべての呼び出しは、クラス内で実行したい
import org.apache.cordova.json4j.JSONArray;
import org.apache.cordova.json4j.JSONException;
import org.apache.cordova.json4j.JSONObject;
- import org.apache.cordova.util.Logger;
/**
* BlackBerry でのプラグインの作り方デモのためのシンプルなプラグイン
* ユーザーがプラグインを呼び出したときのメッセージをそのまま返します
@@ -93,12 +92,11 @@ cordova.exec へのすべての呼び出しは、クラス内で実行したい
PluginResult result = new PluginResult(PluginResult.Status.INVALID_ACTION, "Echo: Invalid action:" + action);
if(action.equals(echo)){
try {
- JSONObject echoObj = new JSONObject();
String theMsg = args.getString(0);
- if(theMsg.length()>0){
+ if(theMsg!= null || theMsg.length()>0){
result = new PluginResult(PluginResult.Status.OK, theMsg);
}else{
- result = new PluginResult(PluginResult.Status.ERROR, theMsg);
+ result = new PluginResult(PluginResult.Status.ERROR, "Nothing to echo.");
}
} catch (JSONException e) {
result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/plugin-development/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/plugin-development/index.md b/docs/jp/2.1.0/guide/plugin-development/index.md
index 1538786..81da8db 100644
--- a/docs/jp/2.1.0/guide/plugin-development/index.md
+++ b/docs/jp/2.1.0/guide/plugin-development/index.md
@@ -109,3 +109,4 @@ Cordova JavaScript とネイティブ環境との間のコミュニケーショ
- Developing a Plugin on iOS
- Developing a Plugin on webOS
- Developing a Plugin on Windows Phone
+- Developing a Plugin on Tizen
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/plugin-development/ios/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/plugin-development/ios/index.md b/docs/jp/2.1.0/guide/plugin-development/ios/index.md
index e655d2d..591ff95 100644
--- a/docs/jp/2.1.0/guide/plugin-development/ios/index.md
+++ b/docs/jp/2.1.0/guide/plugin-development/ios/index.md
@@ -31,8 +31,6 @@ license: Licensed to the Apache Software Foundation (ASF) under one
これは UIWebView から iOS ネイティブ側へのリクエストを整理し、おおよそ要約すると `service` クラスで `action` メソッドを、 `args` 配列で渡された引数と一緒に呼び出すということになります。
-Objective-C プラグインメソッドの `options` パラメーターは非推奨であり、使われるべきではありません。レガシー的な理由で、 `args` 配列の最後の JavaScript オブジェクト要素は、 Objective-C 側メソッドの `options` 辞書に渡されます。どんな JavaScript オブジェクトでも `args` 配列の最後の要素として渡されるべきであり、もし配列の途中の要素に JavaScript オブジェクトがあると、それ以降の Objective-C 側の配列のインデックスがでたらめになることに十分注意してください。 options 辞書はただ1つの JavaScript オブジェクトのみをサポートしており、また配列の一番最後の要素のみネイティブメソッドに渡されます。このようにエラーを起こしやすいので、 `options` は非推奨となっています。
-
このプラグインは、 Cordova-iOS アプリケーションのプロジェクトフォルダーの中の `Cordova.plist` ファイルの `Plugins` キー (辞書) に追加される必要があります。
<key>service_name</key>
@@ -44,32 +42,45 @@ Objective-C プラグインメソッドの `options` パラメーターは非推
私たちはプラグインリクエストをネイティブ側に送る JavaScript を作成しました。また、正しく `Cordova.plist` ファイルでマッピングされた iOS Objective-C プラグインもあります。では、最終的に iOS Objective-C プラグインのクラスがどのようになるのか見ていきましょう。
-JavaScript の `exec` 関数によってプラグインに割り当てられたものは、プラグインクラスの対応する `action` メソッドに渡されます。大半のメソッドの実装は以下のようになります:
+JavaScript の `exec` 関数によってプラグインに割り当てられたものは、プラグインクラスの対応する `action` メソッドに渡されます。プラグインメソッドのシグネチャは次のようになります:
- - (void) myMethod:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+ - (void) myMethod:(CDVInvokedUrlCommand*)command
{
- NSString* callbackId = [arguments objectAtIndex:0];
-
CDVPluginResult* pluginResult = nil;
NSString* javaScript = nil;
@try {
- NSString* myarg = [arguments objectAtIndex:1];
+ NSString* myarg = [command.arguments objectAtIndex:0];
if (myarg != nil) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- javaScript = [pluginResult toSuccessCallbackString:callbackId];
+ javaScript = [pluginResult toSuccessCallbackString:command.callbackId];
}
} @catch (id exception) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]];
- javaScript = [pluginResult toErrorCallbackString:callbackId];
+ javaScript = [pluginResult toErrorCallbackString:command.callbackId];
}
[self writeJavascript:javaScript];
}
+1. [CDVInvokedUrlCommand.h](https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVInvokedUrlCommand.h)
+2. [CDVPluginResult.h](https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVPluginResult.h)
+
+
+## プラグインシグネチャ
+
+**Cordova 2.1.0** からサポートされた **新しいシグネチャ** は次のとおりです:
+
+ - (void) myMethod:(CDVInvokedUrlCommand*)command;
+
+**古い (非推奨)** シグネチャはつぎのとおりです:
-### iOS プラグインの Echo プラグイン
+ - (void) myMethod:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+
+基本的に、オプション辞書は新しいシグネチャでは削除されており、 callbackId は引数配列の 0 番目の要素ではなく、別のプロパティーとなっています。
+
+## iOS プラグインの Echo プラグイン
`Cordova.plist` ファイルの `Plugins` キー (辞書) に以下を追加します:
@@ -81,41 +92,39 @@ JavaScript の `exec` 関数によってプラグインに割り当てられた
/********* Echo.h Cordova Plugin Header *******/
- #import <Cordova/CDVPlugin.h>
+ #import <Cordova/CDV.h>
@interface Echo : CDVPlugin
- - (void) echo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+ - (void) echo:(CDVInvokedUrlCommand*)command;
@end
/********* Echo.m Cordova Plugin Implementation *******/
#import "Echo.h"
- #import <Cordova/CDVPluginResult.h>
+ #import <Cordova/CDV.h>
@implementation Echo
- - (void) echo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+ - (void) echo:(CDVInvokedUrlCommand*)command
{
- NSString* callbackId = [arguments objectAtIndex:0];
-
CDVPluginResult* pluginResult = nil;
NSString* javaScript = nil;
@try {
- NSString* echo = [arguments objectAtIndex:1];
+ NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
- javaScript = [pluginResult toSuccessCallbackString:callbackId];
+ javaScript = [pluginResult toSuccessCallbackString:command.callbackId];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
- javaScript = [pluginResult toErrorCallbackString:callbackId];
+ javaScript = [pluginResult toErrorCallbackString:command.callbackId];
}
} @catch (NSException* exception) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]];
- javaScript = [pluginResult toErrorCallbackString:callbackId];
+ javaScript = [pluginResult toErrorCallbackString:command.callbackId];
}
[self writeJavascript:javaScript];
@@ -126,7 +135,7 @@ JavaScript の `exec` 関数によってプラグインに割り当てられた
コードを見ていきましょう。一番上には、必要なすべての Cordova に関する import 文が並んでいます。クラスは `CDVPlugin` を継承しています - これはとても重要です。
-このプラグインは1つのアクション `echo` のみをサポートしています。最初に、引数配列の0番目の要素である `callbackId` パラメーターを取得します。次に、 `objectAtIndex` メソッドを使って、引数配列の1番目の要素である echo 用文字列を取得します。ここで、少しパラメーターに対してチェックを行います: `nil` チェックや文字列の長さが0でないかどうかなどです。
+このプラグインは 1 つのアクション `echo` のみをサポートしています。最初に、 `objectAtIndex` メソッドを `args` に使って引数配列 0 番目の要素である echo 用文字列を取得します。次に、 `objectAtIndex` メソッドを使って、引数配列の1番目の要素である echo 用文字列を取得します。ここで、少しパラメーターに対してチェックを行います: `nil` チェックや文字列の長さが0でないかどうかなどです。
もしそうであった場合は、ステータスが `ERROR` の `PluginResult` を返します。もしこれらのチェックをパスしたら、ステータスが `OK` の `PluginResult` を返し、パラメーターとして受け取った `echo` 文字列を渡します。そして、もし正常な場合は `toSuccessCallbackString` メソッド、エラーの場合は `toErrorCallbackString` メソッドを呼びだして `PluginResult` を JavaScript に変換します。
@@ -145,6 +154,8 @@ JavaScript の `exec` 関数によってプラグインに割り当てられた
Objective-C 側でデバッグするには、 Xcode のビルトインのデバッガーを使用します。 JavaScript 側では、 [Apache Cordova Project の Weinre](https://github.com/apache/incubator-cordova-weinre) または [サードパーティ製の iWebInspector](http://www.iwebinspector.com/) を使用できます。
+iOS 6 では、 Safari 6.0 を使用して簡単に iOS 6 シミュレーター上で動いているアプリをデバッグできます。
+
## よくある落とし穴
* Cordova.plist にプラグインマッピングを追加することを忘れないでください - もし忘れている場合は、 Xcode のコンソールログにエラーが表示されます
@@ -155,3 +166,10 @@ Objective-C 側でデバッグするには、 Xcode のビルトインのデバ
// 任意のコード
}, 0);
+## 非推奨のプラグインシグネチャに関する注意点
+
+**古い (非推奨)** シグネチャはつぎのとおりです:
+
+ - (void) myMethod:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+
+Objective-C プラグインメソッドの `options` パラメーターは非推奨であり、使われるべきではありません。レガシー的な理由で、 `args` 配列の最後の JavaScript オブジェクト要素は、 Objective-C 側メソッドの `options` 辞書に渡されます。どんな JavaScript オブジェクトでも `args` 配列の最後の要素として渡されるべきであり、もし配列の途中の要素に JavaScript オブジェクトがあると、それ以降の Objective-C 側の配列のインデックスがでたらめになることに十分注意してください。 options 辞書はただ1つの JavaScript オブジェクトのみをサポートしており、また配列の一番最後の要素のみネイティブメソッドに渡されます。このようにエラーを起こしやすいので、 `options` は非推奨となっています。
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/plugin-development/tizen/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/plugin-development/tizen/index.md b/docs/jp/2.1.0/guide/plugin-development/tizen/index.md
new file mode 100644
index 0000000..c210a26
--- /dev/null
+++ b/docs/jp/2.1.0/guide/plugin-development/tizen/index.md
@@ -0,0 +1,23 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+---
+
+Developing a Plugin on Tizen
+============================
+
+プラグインは Tizen プラットフォームでは現在サポートされていません。
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/plugin-development/windows-phone/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/plugin-development/windows-phone/index.md b/docs/jp/2.1.0/guide/plugin-development/windows-phone/index.md
index 35c3cbb..8c79c8f 100644
--- a/docs/jp/2.1.0/guide/plugin-development/windows-phone/index.md
+++ b/docs/jp/2.1.0/guide/plugin-development/windows-phone/index.md
@@ -20,4 +20,173 @@ license: Licensed to the Apache Software Foundation (ASF) under one
Developing a Plugin on Windows Phone
====================================
-準備中です...
+Windows Phone プラグインの開発には、 Cordova のアーキテクチャの理解が必要です。
+Cordova-WP7 は Javascript コードをホストし、
+ネイティブの API 呼び出しを管理する WebBrowser から構成されています。
+C# には継承可能な BaseCommand (`WP7CordovaClassLib.Cordova.Commands.BaseCommand`) クラスがあり、
+このクラスは開発者のために大半の基本的な機能を保持しています。
+
+1. プロジェクトを選択し、右クリックから 'Add -> New Item ...' を選びます
+ - どこに追加するかはあなたの自由ですが、できれば 'Plugins' フォルダーに追加してください
+2. 'Class' を選択し `Echo.cs` と名前をつけます
+ - このクラスの名前は `cordova.exec(win, fail, "Echo", ...)` で呼び出す名前と完全に一致している必要があります
+3. ベースクラスをインクルードします
+
+ using WP7CordovaClassLib.Cordova;
+ using WP7CordovaClassLib.Cordova.Commands;
+ using WP7CordovaClassLib.Cordova.JSON;
+
+4. BaseCommand クラスを継承します
+
+ public class Echo : BaseCommand
+ {
+ // ...
+ }
+
+5. JS から呼び出し可能なメソッドを追加します
+
+ public class Echo : BaseCommand
+ {
+ public void echo(string options)
+ {
+ // 全ての JS から呼び出されるメソッドはこのシグネチャを持つ必要があります
+ // publicで, void を返し, string の引数が 1 つ
+ }
+ }
+
+ネームスペース
+----------
+
+コマンドのデフォルトのネームスペースは:
+
+ namespace Cordova.Extension.Commands
+ {
+ // ...
+ }
+
+もし別のネームスペースを使用したい場合は、 `cordova.exec` の呼び出しの際にネームスペースが省略されていないクラス名を指定する必要があります。
+例えば、もし以下のように C# のクラスを定義した場合は:
+
+ namespace com.mydomain.cordovaExtensions
+ {
+ public class Echo : BaseCommand
+ {
+ // ...
+ }
+ }
+
+JS では、 exec を以下のように呼び出します:
+
+ codova.exec(win, fail, "com.mydomain.cordovaExtensions.Echo", ...);
+
+C# での引数の読み取り
+----------------------------------
+
+プラグインメソッドから受け取った値は文字列ですが、
+JavaScript のコードを見ると、実は文字列の配列を渡そうとしていた、ということがあります。
+JS での `cordova.exec` の呼び出し部分をみると、 `[str]` を渡していることがわかります:
+
+ cordova.exec(win, fail, "Echo", "echo", ["input string"]);
+
+ここで `Echo.echo` メソッドに渡された文字列を検証すると、
+値は実際には次であることがわかります:
+
+ "[\"input string\"]"
+
+全ての Javascript の exec 引数は、 C# に渡される前に JSON エンコードされます。
+
+もしこれを期待している値にしたい場合は、デコードする必要があります。
+シンプルに JSON のデシリアライゼーションを使います。
+
+ string optVal = JsonHelper.Deserialize<string[]>(options)[0];
+ // optVal は "input string" となります
+
+C# から JS へ結果を渡す
+-----------------------------
+
+ベースクラスの BaseCommand はデータを JS のコールバックハンドラーに渡すためのメソッドを提供しています。
+追加情報が必要なく、単にコマンドが成功したことを通知するためには、
+シンプルに以下を呼びます:
+
+ DispatchCommandResult(); // 空のプラグイン結果とともに、成功したとみなされコールバックします
+
+データを返すには、異なる形式の `DispatchCommandResult` を呼ぶ必要があります:
+
+ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "すべて計画通りにいきました。これは成功ハンドラーに渡される結果データです。"));
+
+構造化されたデータを JS に渡すには、 JSON 形式にエンコードされている必要があります:
+To pass structured object data back to JS, it should be encoded as a JSON string:
+
+ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "{result:\"うまくいきました!\"}"));
+
+エラーが発生したことを通知する場合には、 `DispatchCommandResult` を `PluginResult` を伴って呼ぶことができます:
+
+ DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Echo はエラーが発生したと伝えています"));
+
+プラグインの C# メソッドでのシリアライゼーションエラーの対処
+--------------------------------------------------------
+
+引数を解析するときに、万が一不正な入力があった場合のためにも try/catch ブロックを
+使用するとよいでしょう。以下は、 Cordova の C# コードで使われている方法です:
+
+ string optVal = null;
+
+ try
+ {
+ optVal = JsonHelper.Deserialize<string[]>(options)[0];
+ }
+ catch(Exception)
+ {
+ // 例外をキャッチし、 null 値と例外を一緒に対処します
+ }
+
+ if (optVal == null)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ }
+ else
+ {
+ // ... 任意のコードを続けます
+ }
+
+一歩進んだプラグインの機能
+-----------------------------
+
+オーバーライドできるその他の機能については以下を参照してください:
+
+1. [BaseCommand.cs](https://github.com/apache/incubator-cordova-wp7/blob/master/templates/standalone/cordovalib/Commands/BaseCommand.cs)
+
+例えば、 'pause' や 'resume' といったアプリケーションイベントもオーバーライドできます。
+
+### プラグインのデバッグ
+
+C# 側でデバッグするには、 Visual Studio のデバッガーを使用します。クラスの任意の箇所に
+ブレークポイントを設置してください。
+
+Windows Phone での Javascript のデバッグは少し難しいです。 `console.log` を使用して
+プラグインの状態を出力するなどの方法をとる必要があるでしょう。
+
+よくある落とし穴
+---------------
+
+- JavaScript 実装時に、プラグインに渡す引数を決める際には十分に注意してください。
+ 大半のデバイスは cordova.exec に渡される引数は配列であると期待していますが、
+ もし配列の中に異なる形式のオブジェクトが含まれる場合は、
+ デシリアライズが非常に困難、もしくは不可能となってしまいます。
+
+ cordova.exec(win, fail, "ServiceName", "MethodName", ["これは文字列です", 54, {literal:'trouble'}]);
+
+ - これは、以下のようなデコードが非常に困難な文字列を C# 側で受け取ることを意味します:
+
+ "[\"これは文字列です\", 54, { literal:'trouble' }]"
+
+ - exec を呼び出す前に、全てのパラメーターを文字列に変換することを考慮してください:
+
+ cordova.exec(win, fail, "ServiceName", "MethodName", ["これは文字列です", "54", "{literal:'trouble'}"]) ;
+
+ string[] optValues = JsonHelper.Deserialize<string[]>(options);
+
+- exec を呼び出す前に JavaScript コード内でパラメーターのチェックをすることを心がけましょう。
+ これは JS のコードをプラグインの異なるネイティブ実装間で
+ 再利用しやすくするという利点もあります。
+
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/upgrading/android/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/upgrading/android/index.md b/docs/jp/2.1.0/guide/upgrading/android/index.md
index 1ab5edb..c97de1e 100644
--- a/docs/jp/2.1.0/guide/upgrading/android/index.md
+++ b/docs/jp/2.1.0/guide/upgrading/android/index.md
@@ -23,6 +23,16 @@ Upgrading Cordova Android
これは、 Cordova を古いバージョンから新しいバージョンにアップグレードする必要がある人のためのドキュメントです。
+## 2.0.0 から 2.1.0 へのアップグレード ##
+
+1. プロジェクトの libs ディレクトリから cordova-2.0.0.jar を削除します
+2. プロジェクトの libs ディレクトリに cordova-2.1.0.jar を追加します
+3. もし Eclipse を使用している場合は、プロジェクトをリフレッシュし clean を実行します
+4. 新しい cordova-2.1.0.js をプロジェクトにコピーします
+5. HTML を、新しい cordova-2.1.0.js を使って更新します
+6. res/xml/config.xml を framework/res/xml/config.xml と同じとなるようにコピーします
+
+
## 1.9.0 から 2.0.0 へのアップグレード ##
1. プロジェクトの libs ディレクトリから cordova-1.9.0.jar を削除します
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/upgrading/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/upgrading/index.md b/docs/jp/2.1.0/guide/upgrading/index.md
index 5eccdfc..9109401 100644
--- a/docs/jp/2.1.0/guide/upgrading/index.md
+++ b/docs/jp/2.1.0/guide/upgrading/index.md
@@ -29,3 +29,4 @@ license: Licensed to the Apache Software Foundation (ASF) under one
- Upgrading Cordova webOS
- Upgrading Cordova Windows Phone
- Upgrading Cordova Bada
+- Upgrading Cordova Tizen
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/upgrading/ios/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/upgrading/ios/index.md b/docs/jp/2.1.0/guide/upgrading/ios/index.md
index e890934..5606d2e 100644
--- a/docs/jp/2.1.0/guide/upgrading/ios/index.md
+++ b/docs/jp/2.1.0/guide/upgrading/ios/index.md
@@ -22,10 +22,34 @@ Upgrading Cordova iOS
**Xcode 4 が必須** であることに注意してください。 Apple App Store に提出するためには、最新バージョンの iOS SDK (iOS 5.1) を使用する必要があります。 iOS 5.1 は Xcode 4 を必要とします。
+## 2.0.0 から 2.1.0 へのアップグレード ##
+
+**Cordova 2.1.0** では、 CordovaLib は **Automatic Reference Counting (ARC)** を使用するようにアップグレードされました。 CordovaLib を使用するにあたって **ARC** にアップグレードする必要はありませんが、もしプロジェクトを **ARC** を使用するようにアップグレードしたい場合は、メニューから Xcode migration wizard : **Edit -> Refactor -> Convert to Objective-C ARC…** を使用して、 **libCordova.a を選択解除** し、ウィザードを完了してください。
+
+1. ハードディスクの**恒久的なフォルダー** (例: ~/Documents/Cordova-2.1.0) に **Cordova 2.1.0 をダウンロードし解凍**します
+2. Xcode が起動している場合、 **終了** します
+3. **Terminal.app** を使用して、Cordova をダウンロードしたディレクトリまで **移動**します
+4. コマンドラインツールから [**新規プロジェクトを作成**](guide_command-line_index.md.html#Command-Line%20Usage_ios) します - この新規プロジェクトからアセットを持っていきます
+5. 新規プロジェクトから **www/cordova-2.1.0.js** ファイルを **www** フォルダーに **コピー** し、 **www/cordova-2.0.0.js** ファイルを削除します
+6. **www/index.html** ファイル (また、他に Cordova script を参照しているファイル) の Cordova script 参照部分を、新しい **cordova-2.1.0.js** ファイルを参照するように **更新** します
+7. **AppDelegate.m** を新規プロジェクトから更新 (または、もしファイルを変更してなかった場合は置換) します:
+ - 編集されたもの -> application:didFinishLaunchingWithOptions:
+ - 追加されたもの -> application:supportedInterfaceOrientationsForWindow:
+8. **MainViewController.m** を新規プロジェクトから更新 (または、もしファイルを変更してなかった場合は置換) します:
+ - 追加されたもの -> viewWillAppear
+9. **"cordova"** フォルダーを新しいプロジェクトから既存プロジェクトのルートフォルダーにコピーします **(2.1.0 では、スペースを含むパスをサポートするようになりました)**
+10. **プロジェクト** から **VERSION** ファイルの参照を削除します (CordovaLib にあるものでは**ありません**)
+11. 次に、 CordovaLib のサブプロジェクトの参照を更新します。 Cordova 2.1.0 から、 CordovaLib がどこに存在するかを示す CORDOVALIB という Xcode の変数は使用しなくなり、絶対ファイル参照となりました。
+ 1. **Terminal.app** を起動します
+ 2. **ステップ 1** で Cordova をインストールした位置の、 **bin** サブフォルダーに移動します
+ 3. 以下のスクリプトを走らせます。パラメーターは、プロジェクトの **.xcodeproj** ファイルへのパスです
+
+ `update_cordova_subproject path/to/your/project/xcodeproj`
+
## 1.9.0 から 2.0.0 へのアップグレード ##
1. Cordova 2.0.0 を **インストール** します
-2. コマンドラインツールから **新規プロジェクトを作成します** - この新規プロジェクトからアセットを持っていきます
+2. コマンドラインツールから [**新規プロジェクトを作成**](guide_command-line_index.md.html#Command-Line%20Usage_ios) します - この新規プロジェクトからアセットを持っていきます
3. 新規プロジェクトから **www/cordova-2.0.0.js** ファイルを **www** フォルダーに **コピー** し、 **www/cordova-1.9.0.js** ファイルを削除します
4. **www/index.html** ファイル (また、他に Cordova script を参照しているファイル) の Cordova script 参照部分を、新しい **cordova-2.0.0.js** ファイルを参照するように **更新** します
5. 新規プロジェクトから **"cordova"** フォルダーを、 root フォルダーにコピーします (もしコマンドラインツールを使用したい場合)
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/upgrading/tizen/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/upgrading/tizen/index.md b/docs/jp/2.1.0/guide/upgrading/tizen/index.md
new file mode 100644
index 0000000..bea8495
--- /dev/null
+++ b/docs/jp/2.1.0/guide/upgrading/tizen/index.md
@@ -0,0 +1,23 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+---
+
+Upgrading Cordova Tizen
+======================
+
+これは、 Cordova を古いバージョンから新しいバージョンにアップグレードする必要が>ある人のためのドキュメントです。
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/upgrading/webos/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/upgrading/webos/index.md b/docs/jp/2.1.0/guide/upgrading/webos/index.md
index 72cda91..4e0914d 100644
--- a/docs/jp/2.1.0/guide/upgrading/webos/index.md
+++ b/docs/jp/2.1.0/guide/upgrading/webos/index.md
@@ -22,30 +22,17 @@ Upgrading Cordova webOS
これは、 Cordova を古いバージョンから新しいバージョンにアップグレードする必要がある人のためのドキュメントです。
-## 1.9.0 から 2.0.0 へのアップグレード ##
+## 2.0.0 から 2.1.0 へのアップグレード ##
-1. cordova-1.9.0.js をプロジェクトから削除します
+1. cordova-2.0.0.js をプロジェクトから削除します
2. index.html から次の行を更新します:
次から:
- <script type="text/javascript" src="cordova-1.9.0.js"></script>
-
- 次に変更します:
<script type="text/javascript" src="cordova-2.0.0.js"></script>
-3. makefile を実行し、新しいバージョンの cordova-2.0.0.js ファイルを生成します
-
-## 1.8.1 から 1.9.0 へのアップグレード ##
-
-1. cordova-1.8.1.js をプロジェクトから削除します
-
-2. index.html から次の行を更新します:
-
- 次から:
- <script type="text/javascript" src="cordova-1.8.1.js"></script>
-
次に変更します:
- <script type="text/javascript" src="cordova-1.9.0.js"></script>
+ <script type="text/javascript" src="cordova-2.1.0.js"></script>
+
+3. makefile を実行し、新しいバージョンの cordova-2.1.0.js ファイルを生成します
-3. makefile を実行し、新しいバージョンの cordova-1.9.0.js ファイルを生成します
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/94c825f6/docs/jp/2.1.0/guide/whitelist/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.1.0/guide/whitelist/index.md b/docs/jp/2.1.0/guide/whitelist/index.md
index 3e5fa9b..15aee5f 100644
--- a/docs/jp/2.1.0/guide/whitelist/index.md
+++ b/docs/jp/2.1.0/guide/whitelist/index.md
@@ -58,7 +58,7 @@ Android
### 詳細
-ホワイトリストのルールは `res/xml/cordova.xml` で見つけることができ、 `<access origin="..." />` 要素によって宣言できます。
+ホワイトリストのルールは `res/xml/config.xml` で見つけることができ、 `<access origin="..." />` 要素によって宣言できます。
Android はホワイトリストのシンタックスをフルサポートしています。
@@ -111,7 +111,6 @@ iOS
2. `ExternalHosts` キー配下に新しい文字列を追加します
- XML の直接編集を避けるため、 Xcode を使用することを勧めます
-ドメインのプロトコル (例: `http://` 及び `https://`) は iOS ではサポートされていません。
### シンタックス
@@ -153,6 +152,34 @@ Windows Phone
ドメインホワイトリストは Windows Phone ではサポートされていません。デフォルトとして、全てのドメインにアクセス可能です。
+Tizen
+----------
+
+### 詳細
+
+ドメインホワイトリストのルールはアプリケーションのルートディレクトリにある `config.xml` で見つけることができます。
+これらは、 `<access origin="..." />` 要素によって宣言されています。
+詳細については、 [Tizen Accessing External Network Resources documentation][9] を参照してください。
+
+
+### シンタックス
+
+[google.com][2] のアクセス:
+
+ <access origin="http://google.com" subdomains="false" />
+
+[google.com][3] へのセキュアアクセス (`https://`):
+
+ <access origin="https://google.com" subdomains="false" />
+
+[google.com][2] のすべてのサブドメインへのアクセス:
+
+ <access origin="http://google.com" subdomains="true" />
+
+`file://` プロトコルを含むすべてのドメインへのアクセス:
+
+ <access origin="*" subdomains="true" />
+
[1]: http://www.w3.org/TR/widgets-access/
[2]: http://google.com
[3]: https://google.com
@@ -161,3 +188,4 @@ Windows Phone
[6]: http://docs.google.com
[7]: http://developer.mozilla.org
[8]: https://developer.blackberry.com/html5/documentation/ww_developing/Access_element_834677_11.html
+[9]: https://developer.tizen.org/help/topic/org.tizen.help.gs/Creating%20a%20Project.html?path=0_1_1_4#8814682_CreatingaProject-AccessingExternalNetworkResources