Archive for 7 月, 2010

WindowsでiPhone Applicationを作るには:

火曜日, 7 月 6th, 2010

ちょっとiPhone ApplicationをWindowsで作る方法を調べておりまして見つけたページを何となく気分が乗ったので、和訳してみました。 技術的な文書って翻訳楽ですよねー(少なくとも大意は…の割りに時間がかかりましたが)。 原文はこのHow To Develop iPhone Apps on Windowsです。 2009/12/03の記事なので、半年前ですから、一部古くなっている部分もあると思われますが、そのまま転載します。 特に「一番簡単で効果的な方法」が使える見込みが事実上ない辺りがなんともはや…。 画像や動画は転載しませんので、元記事をご参照下さい。 翻訳文の文責は全て私にあります。 事実誤認や誤訳等はビシバシコメント下さい。


Not many developers speak Objective C, the Mantra for writing iPhone applications. And majority of the developers don’t own Mac either, so what is the way to go ?
それほど大勢の開発者がObjective C-iPhone アプリケーションを書くための真言[*1]-を操れる訳ではない。さらに開発者の多数派はMacも持っていない[*2]。ではどうすればいいだろうか?

Of course one can buy a macbook and do it. Here’s what will make it possible do all that on Windows, Linux
勿論誰でもmacbookを買って行うことはできる。ここではどうすれば全てをWindowsやLinux上で行えるかを述べる。

Top 5 Ways:

主要5手段:

Method 5. Toolchains: There are several toolchains available (like winChain) that actually lets you write and build iPhone applications on windows.
方法5. Toolchains: 幾つか利用可能なツールチェーン[*3](winChainのような)があり、実際にiPhoneアプリケーションをWindows上で書いて動かすことが出来る
There are several associated tutorials to build the Objective C code on Windows.
幾つかObjective CのコードをWin上でビルドするのに関連したチュートリアルがある。
But there is a problem, the apps hence developed will work on Jailbroken iPhones only.
しかし問題が一つあり、つまり脱獄[*4]したiPhoneでしかアプリケーションが動かない。
We’ve seen few hacks to get over that and make it to App Store, but as Apple keeps on updating SDKs, toolchains need regular updates.
我々は困難を乗り越えてApp Storeにそれを置く裏ワザ知らない訳ではないが、AppleはSDKを更新し続けているので、toolchainもいつも更新が必要である。
It’s a hassle to make it up all the time. That’s why this is the least of the recommended methods.
いつもそうしておくのは大変だ。なので、もっともお勧めできない方法である。

Method 4. Use other Languages instead of Objective-C
方法 4.Objective-Cに代わる他の言語を使う
(i) Code in Java: For Java developers, there is a workaround: XMLVM.
(i) Javaで書く: Javaの開発者向けの迂回策: XMLVM.
XMLVM is an extensible cross-compiler toolchain which instead of cross-compiling on a source code level, XMLVM cross-compiles byte code instructions from Sun’s Java virtual machine and Microsoft’s Common Language Runtime (CLR).
XMLVMは拡張可能なクロスコンパイラ[*5]ツールチェーンで、ソースコードレベルでクロスコンパイルする代わりに、SunのJavaヴァーチャルマシンとMicrosoftのコモンランゲージランタイム(CLR)のバイトコードの命令をクロスコンパイルする。
And the Result: The byte code instructions are easier to cross-compile and the difficult parsing of a high-level programming language is left to a regular compiler and you get to write apps in different language and then compile and convert to a different one.
つまり:バイトコードの命令はクロスコンパイルし易く、高水準プログラミング言語を正規のコンパイラを離れて解釈するのは大変なので、違う言語でアプリケーションを書き、コンパイルし、そして別の言語のものに変換する。
The diagram below shows an abstract idea:
下の図(※転載しません)で概要が分る:
Without laying much stress on it, I`ll share my experience.
強調しないが、経験を書いておこう。
The project is a great piece of Innovation but is still in it’s early phases.
プロジェクトは大変進歩したものの、依然として始まったばかりである。
On one side, I was able to use their API and develop fairly well application (Simple game, Travel app), but when it comes to complex graphics, features, this method looked pretty immature.
そのAPIを使ってまずまず良いアプリケーション(単純なゲーム、旅行アプリ)を開発できたが、一方複雑なグラフィクスや、外見については、この方法は非常に未熟であるようだ。
However, over time this should change and we could see the project doing almost everything the original SDK does.
しかし、時が経てばこれらは変わり、我々はプロジェクトが”本家”のSDKが出来ることはほとんど出来るようになるのを目にするだろう。
And yes, you can test your apps on the Java based simulator and deploy on jailbroken iPhone.
そして勿論、Javaベースのシミュレータでアプリをテストできるし、脱獄したiPhoneに展開できる。

There are several other frameworks (like Appcelerator`s Titanium) that let you code iPhone apps in Java, but the limitations are similar thought they are all worth giving a look for most day-to-day apps.
他にも幾つかiPhoneのアプリをJavaで書けるフレームワークがある(例えばAppceleratorTitanium)が、制限は似たようなものでちょっとしたアプリになら使ってみる価値はあるだろう。
Update: (ii): Code in C/C++
追記: (ii):C/C++で書く
DragonFireSDK: Say no to Objective C, say no to forced-Mac and yes to C/C++, Windows.
DragonFireSDK: Objective CもMac強制はダメ、Windows C/C++がいい。
This founds the base for DragonFireSDK that uses Microsoft Visual C++ to develop, test iPhone apps.
これはMicrosoft C++を使ったDragonFireSDKを元に開発しているようで、iPhoneアプリもテストされている。

Apps, Games created with DragonFireSDK can be completely written and debugged in Windows and are also fully compliant for distribution and sales at the Apple iPhone App Store.
DragonFireSDKで作ったアプリやゲームは完全に書くのもデバッグもウィンドウズで出来て、さらに配布にも完全に対応していてAppleの iPhone App Storeで売られている。

There is a quick Starter Guide available that help you kick start writing your first iPhone app and run it inside the emulator that ships with it.
クイックスタータガイドがあるのであなたの初iPhoneアプリを書いて付属のエミュレータで走らせるのに役立つだろう。
The API is quiet simple to use and is available here.
APIはとても使うのが簡単でここで見られる。
One of the Apps: Un Stacker developed using this SDK is already available on App Store [link].
アプリのひとつ:Un Stackerは開発にこのSDKを使っていて、既にApp Storeから利用可能である[リンク]。
In addition, 5 Sample Apps are demonstrated and explained with code.
加えて、5つのサンプルアプリがあって、コードの解説もついている。

Method 3. Hackintosh: This is one of the effective ways of doing it: Install Mac on PC and then run the Native iPhone SDK.
方法3. ハッキントッシュ: これは最も効果的な方法の一つである:PC[*6]にMacをインストールしてネイティヴのiPhon SDKを走らせる。
This is already a popular practice among OSx86 communities.
これは既にOSx86コミュニティの間で一般的である。
The only limitation is that it could get tricky and time consuming for the newbees.
唯一の制限はトリッキーかつ初心者には時間がかかることだ。
You can refer to our Hackintosh Guides:
我々のハッキントッシュガイドを参照するといいだろう。(表割愛)

Method 2.: Cross compilation of Adobe apps: You can write your apps in Flash Actionscript 2, ActionScript 3 or Adobe AIR, Flex and then cross compile it to ARM binary that is executable on iPhone.
方法2.:アドビのアプリケーションでクロスコンパイル:ActionScript 2、ActionScript3またはAdobe AIR、Flexでアプリを書いてそれをiPhoneで実行可能なARMバイナリにクロスコンパイルすることができる。
This can be done installing Project Sprouts for which sample Flex applications source is available here.
これはプロジェクトスプラウツをインストールすると可能で、サンプルFlexアプリケーションのソースはここで手に入る

Here is a video on how this is done:
やり方のビデオを置いておく(割愛):

Method 1. Flash CS 5: This is in fact the most effective and easiest way to make it to App store doing all the “legal stuff”.
方法1.Flash CS 5: これは実際Appストアに全部”正規の原料”で置ける、最も効果的で簡単な方法である。

Flash CS 5 introduces new Feature that let’s you develop iPhone native applications just like you develop Adobe AIR apps.
Flash CS 5 はAdobe AIRアプリを開発するようにiPhoneのネイティヴアプリケーションを開発する新機能を発表した。
Recently, Adobe announced support for Multitouch, Accelerometer, GPS support in Flash 10.1 for phones.
最近、Adobeはマルチタッチ、加速度センサ、GPSを携帯電話用Flash 10.1でサポートと発表した。
CS5 adds new APIs that lets developers leverage these modern Phone features and hence develop application not just for iPhone but for all Phones that support Flash.
CS5には開発者が新型携帯電話の機能を操作でき、今後iPhoneに限らずFlashをサポートするどんな携帯電話のアプリケーションでも開発できる、新しいAPIが追加された。

So the Horizon is quiet big, and CS5 with ActionScript could find a great way to develop applications on iPhone.
地平は広大で、ActionScriptとCS5はiPhoneのアプリケーションを開発する重要な方法になりうるように思える。
If you are familiar with a scripting language, say, Javascript, learning ActionScript is as easy as an ApplePie.
もしJavaScriptのようなスクリプト言語に親しんでいるなら、ActionScriptを学ぶのはアップルパイと同じくらい簡単である。

Already, App Store has a number of Apps built based on Flash (I believe they are using Crosscompilation): you can checkout few full blown apps here.
既に、App StoreにはいくつかのFlashに基づいてビルドされた(私はクロスコンパイルを使ったものだと思うが)がある: 少ないが本格的なアプリをここで確認できる。

Only bad part of this method is, it’s still unavailable. However This is what Official adobe site has to say about it:
この方法の唯一の欠点は、まだ使えないことである。しかしadobeの公式サイトではこう言っている:

When will the Flash Professional CS5 beta be available for download?
Flash Professional CS5 betaはいつからダウンロードできるようになるか?
The beta will be available for download from Adobe Labs before the end of 2009.
betaは2009年末までにAdobe Labからダウンローできるようになるだろう。

You can develop, build and test in native Flash debugger, however, soon we should see a simulator for mobile devices, especially for the iPhone.
開発し、ビルドし、Flashネイティヴなデバッガでテストできるが、すぐにモバイル機器、特にiPhone用のシミュレータを見られるだろう。

I needed more clarity whether the final step, signing of Apps would be possible on Windows.
私は最終的なWindowsでアプリが作れるかどうかの証拠が、もっと明快に必要だった。
I contacted Adobe on this.
これについてAdobeに尋ねた。
Alexander MacDonald said “Once you have created your content it is compiled into an iphone executable, then signed by our ADT tool and then zipped to create an ipa-the only thing you need from apple is your developer certificate.
アレクサンダー・マクドナルドは「一度iPhoneで実行可能な形にコンパイルしたら、我々のADTツールで署名と圧縮をしてipaを作る。すべきことはAppleから開発者証明を手に入れることだけだ。
The crypto algorithms used by Apple to sign iPhone apps are all industry standard ones which anyone can implement on any platform they wish,” which in the case of Flash CS5, also includes Windows.
iPhoneのアプリの署名にアップルが使っている暗号アルゴリズムは全工業標準のもので、望むなら誰でもどんなプラットフォームでも実行できる」 Flash CS5の場合、Windowsに含まれている。

The app hence created can be installed to iPhone via iTunes for testing to substitute absence of simulator for the mean time.
今後作られるアプリはシミュレータが出来るまで、代わりにテストのためiTunesからiPhoneにインストールできる。
So all in all, everything would be legal, and will work great.
そして概してすべては正規の手続きで、非常に上手く動作する。

However, here is the demo of how applications will be created in Flash CS5:
ここにどのようにFlash CS5でアプリケーションが作られるかのデモを置く(割愛):

Today, it doesn’t support everything SDK supports, but it would soon do.
今はSDKがサポートしているすべてをサポートしてはいないが、すぐそうなるだろう。
With Flash opening up a way to iPhone development, Adobe is adding millions of new developers to the iPhone App store contributors.
FlashによるiPhone開発の道が開かれれば、Adobeは100万人の新しい開発者をiPhone App Storeの貢献者に加えることになる。

Mantra/真言

マントラ、真言とは密教なんかで使う呪文のことです。

Objective C

Objective Cは、Mac OSに付属する開発環境X codeで利用可能な言語です。基本的にはWinでは使えません。Winでは似たような位置にC#が居ます。

Toolchain

Toolchainとは、単機能な複数のツールを組み合わせて作業する事を指すのでしょう。

脱獄/Jail Break

App Storeを通さずに、つまりAppleが規約で認めていないようなアプリケーションをインストールするのに必要な作業で、これ自体も規約に違反する。 が、面白いことが出来るようになるのでやる人は居る。Appleからの保証が受けられなくなる。

クロスコンパイラ/cross-compiler

ソースコード、つまり人間が読める命令文を機械が処理する命令に変換する作業をコンパイルと言います。普通しないような、ソースコードと命令セットでの変換をクロスコンパイルと言います。例えば通常MacならMac用の命令に、WinならWin用の命令に変換されます。それをWinでMac用の命令セットに変換したりします。

PC

ここでの”PC”が指しているのは、Parsonal Computer一般ではなく、IBMのPC/AT互換機のこと。