ラベル Titanium Mobile の投稿を表示しています。 すべての投稿を表示
ラベル Titanium Mobile の投稿を表示しています。 すべての投稿を表示

2014/06/17

Titanium mobile [end tag name: string is not match the current start tagName:string]

超久しぶりのTitanium mobileネタ。

ちょっと前に作ったアプリを修正する必要があり3.1.2から3.2.3GAへ。

そしたらコンパイルでコケル。 なぜだーと調べてみたらこんなエラー。

end tag name: string  is not match the current start tagName:string 
@#[line:242,col:21]
/Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/node_modules/xmldom/dom-parser.js:187
     throw error;
           ^
end tag name: string  is not match the current start tagName:string
そうだ、なんかParserかわったんだっけ。

調べてみると、わかりました。

</string>である場所が</string >>の前にスペースが入っちゃってました。。。

パーサーかえるとかこの手の変更はマジ簡便してほしい。。。

JSONのパースでこけたりしたら想像するだけでうんざり系の対応だな。。。

アプリで対応できるものはよいけど、サーバー側が自分たちの管理している仕組みでなかったりするとえらく大変。

2013/07/07

[Titanium mobile] Google playでのアルファ版・ベータ版配布機能を使ってみた

Titanium mobileで作成したアプリにてアルファ版・ベータ版配布機能をテストしてみた。
上げ方等は、他のサイトで詳しくかかれているのでそちらで。

私が知りたかったのは、有料アプリをベータ版やアルファ版では無料で提供できるのか?ってことだったのです。

なかなかそこに言及している記述が見当たらなかったので試してみた。

結果としては、だめでした。。。

まだ、ストアにのせる前の状態で価格設定を無料にして、とりあえずβユーザーに使ってもらうっていうのなら可能だけど、既に有料で公開しているアプリにはそれはできないみたいだね。
うーん、iTunes ストアのプロモーションコード的な機能ってPlay storeにはないのかね。

もうちょっと調べるか。

2013/05/08

[Titanium Mobile] AndroidでのsearchBar使用時のfilterAttributeの設定時の注意

久しぶりのTitanium mobile ネタ。
Titanium 3.1.0GAです。

有名な話かもしれないけど、自分用のメモとして。。。

Table に対してsearchBarを設定しようとしたら。

Androidでフィルタリングが動作しない場合が発生してなんだこれはと。

で、しらべてみたところ、filterAttributeの設定の仕方の問題みたいです。

filterAttributeを 'filter' とした場合、

var tableViewRow = Ti.UI.createTableViewRow({filter:'ああああ',...});
だと正しく動きますが、

tableViewRow.filter = 'ああああ';
だと動きません。

iPhoneだと両方問題なく動作します。

これはハマった。。。

2013/03/22

AndroidのバージョンとAPIレベルの関係

自分用メモ。

Android 4でPicker(Titanium.UI.PICKER_TYPE_TIME)がちゃんと動きません。

 詳しくはこちら。 #助かりました。

そんなわけで、AndroidのAPI Levelで挙動を切り分ける必要があったので、
下に調べたものを貼っておきます。


Platform VersionAPI LevelVERSION CODE
Android 4.0.315ICE_CREAM_SANDWICH_MR1
Android 4.0.214ICE_CREAM_SANDWICH
Android 4.0.1
Android 4.0
Android 3.213HONEYCOMB_MR2
Android 3.1.x12HONEYCOMB_MR1
Android 3.0.x11HONEYCOMB
Android 2.3.410GINGERBREAD_MR1
Android 2.3.3
Android 2.3.29GINGERBREAD
Android 2.3.1
Android 2.3
Android 2.2.x8FROYO
Android 2.1.x7ECLAIR_MR1
Android 2.0.16ECLAIR_0_1
Android 2.05ECLAIR
Android 1.64DONUT
Android 1.53CUPCAKE
Android 1.12BASE_1_1
Android 1.01BASE

Google Playで販売したアプリをGoogle Checkoutから返金

Google Playで販売したアプリをGoogle Checkoutから返金処理してみました。

どんな挙動になるのかなと思ったけど、
・アプリは削除されません。

・アプリのアップデートは普通に走ります。

うーむ、これ、安易に返金処理しちゃだめだな~


2012/12/10

[Titanium Mobile]Your app crashed on both Wi-Fi and cellular networks immediately after launch.だって。。。

こちらは会社で申請中のアプリですが、リジェクト二回目です。。。 わかんねー。

実機でちゃんと動くんだけどな。。。

 2.1

We found that your app crashed on iPhone 5, running iOS 6.0.1, which is not in compliance with the App Store Review Guidelines.

Your app crashed on both Wi-Fi and cellular networks immediately after launch.

We have attached detailed crash logs to help troubleshoot this issue. For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to include any symbolicated crash logs, screenshots, or steps to reproduce the issues when you submit your request. 

For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to:

- include the complete details of your rejection issues
- prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up. 

For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

If you have difficulty reproducing this issue, please try testing the workflow as described in <https://developer.apple.com/library/ios/qa/qa1764/>Testing Workflow with Xcode's Archive feature".

 #追記です。解決したかも!

とりあえず、Titaniumのビルド時にできる○○○○○.xcodeprojから、Xcodeを起動すると。
で、Xcodeのメニューから product > edit schemeでてくるダイアログの
Run〜(アプリ名)のBulid Configuration をDeveloperに変更して起動する。

そうすると確かに、起動時にエラーとして引っかかる箇所が出てきました。
ログをみると××××.js line 9でERRORみたいなのが書かれてるけど、これTitaniumで編集しているJSファイルではなく、Xcodeで実行?するように最適化されたの中間ファイル的なJSです。
××××.jsなら××××_.jsで探せば出てきます。
場所は/DerivedDataの下にあります。(検索すればすぐなのでパスの詳細は省略)

さー、再申請するぞ!






2012/11/26

[Titanium mobile]アプリ名の変更方法(How to Change the Titanium mobile App Name)

アプリをリリースすることになりましてと、名前が決まりましたー。
それでは名前変更するかとなって、tiapp.xmlの<name>ほにゃらら</name>を変更したら、ビルドする走らなくなる。。。。

海外の方の「Projectごと作りなおせよ、HA!HA!」みたいな書き込みをみて、つくりなおしてみたら、起動しないし。。。

なにそれー。てゆーか、調べてみるとハマった人も多いみたいね。


こ、この感じ久しぶり><

周りに理解してもらえないハマり時間が来たか?とうんざりしてたら、ここに変え方が書いてありました。

https://wiki.appcelerator.org/display/guides/Internationalization

正しくは、アプリ名を他言語対応するためのTipsだけど、作成しているアプリが他言語対応アプリなのでまぁよしと。

iOS用とAndroid用で方法は異なります。

でiOS側の変更方法は、以下の画像のようにi18nの下にapp.xmlを作成。


i18n/ja/app.xmlの中身は、こんだけ
<?xml version="1.0" encoding="UTF-8"?>
<
resources>
   
<string name="appname">CRM Touch</string>
</
resources>
Android用はというと
ビルドするとできる/build/android/AndroidManifest.xmlを
プロジェクト直下の/platform/android/にコピーします。
#フォルダは作成しましょう。

そして、AndroidManifest.xmlのandroid:label=""の部分をandroid:label="@string/app_name"と変更して(2カ所ありました)、i18nの下にstring.xmlに以下を
    <string name="app_name">CRM Touch</string>
を追加。

enやja等複数対応予定ならその数だけ追加しましょう。

これだけです。

[Titanium mobile]Titanium mobileでターゲットのiOSをしぼる方法

tiapp.xmlに以下を追加です。

<ios>
    <min-ios-ver>5.0</min-ios-ver>
</ios>

これだけです。

2012/10/31

[Titanium mobile]Galaxy S3でhasChild等のデフォルトのアイコンが小さすぎる

Android解像度の問題だと思うけど、tableViewRowにhasChildやhadDetailを設定したさいにでてくるデフォルトのアイコンが、Galaxy S3みたいな高解像度のデバイスでつかうと、ものすんごく小さくなってしまって。

えー、これどうすうのと調べたところ "Resources"と同じ階層にある"tiapp.xml"に下記を追加すると解決する。

    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <supports -screens="-screens" android:anydensity="false">
        </supports></manifest>
    </android>

"<supports -screens="-screens" android:anydensity="false">"を追記するだけでとりあえず解決はしました。

この項目、いろいろ調べてみないとなと。

2012/10/22

[Titanium mobile]AndroidでTextFieldの入力が一文字ごとにフォーカスが外れてしまう

TableViewの中のTableViewRowにTextFieldを設置ししたところ、一文字入力するたびにフォーカスがはずれて入力できない。

なんか、ソフトキーボードがわるさしてんのかな? まいったなーと調べてみたら、先人がいました。 

TabGroup又はWindowにwindowのSoftInputModeにTi.UI.Android.SOFT_INPUT_ADJUST_PANを設定すると問題を回避できるとのことです。

var isAndroid = Ti.Platform.osname == 'android';

var self = Ti.UI.createWindow({
backgroundColor : '#ffffff', windowSoftInputMode : isAndroid ?Ti.UI.Android.SOFT_INPUT_ADJUST_PAN : null
}); 

みたいな感じ。

iPhoneに設定するとエラーになっちゃうのでちゃんとnullをセットしましょ。

2012/10/16

[Titanium mobile]addEventListenerした無名関数(Anonymous function)をremoveEventListenerする方法

Titanium mobileでaddEventListenerする時に無名関数を利用した時のremoveEventListenerする方法。

通常は removeEventListener(イベント名, 関数名); で登録したイベントを解除出来るけど、無名関数の場合どうすんだと。

調べたらjavascriptの一般的な方法らしいんだけど、無名関数内で、関数名の代わりに「 arguments.callee 」を使用してremoveEventListenerするだけです。

addButton.addEventListener('click', function(e) {
 //何かの処理
 e.source.removeEventListener('click', arguments.callee);
 });
iOSもAndroidも問題なく動いてます。

ちなみにだけど、いままで無名関数ってよんできたけど、英語だと「Anonymous function」と呼ぶみたいですね。

2012/10/12

[Titanium mobile]iPhoneとAndroidでの挙動の違い requireのパスの大文字小文字


たまたまきがついたのだけど、
Titanium mobile でrequireでファイルを呼び出すパスの指定の仕方だけど、
iOSだと、小文字大文字関係なしに指定で居るけど、
Androidだと小文字と大文字は区別されちゃいます。

そんだけ
あと、2.1.3にしたらアプリが起動しなくなって泣きそうです。
2.1.2に戻しました。。。なんでだ?

2012/10/04

[Titanium mobile]Titanium SDKがアップデート:Titanium SDK 2.1.3 - 10/03/2012


Titanium SDK 2.1.3 - 10/03/2012
Contents
  • About This Release
  • Support for iOS 6 and iPhone 5
  • iOS Platform Fixes and Enhancements
  • Android Platform Fixes and Enhancements
  • Known Issues

About This Release
Titanium SDK Release 2.1.3 is a service pack release of the Titanium SDK, including bug fixes for high-priority issues occurring in Releases 2.1.0, 2.1.1, and 2.1.2.
In addition to fixes for the Android and iOS platforms, this release adds support for iOS 6 and the Xcode 4.5 releases.

Support for iOS 6 and iPhone 5
This release includes support for iOS 6 and Xcode 4.5. It has been tested using Xcode 4.5 and using iOS 6 on the iPhone 5 as well as earlier devices.
The following notes apply to iOS 6 and the iPhone 5.
ARMv6 Support and Min iOS Version
The ARMv6 architecture is no longer supported in iOS 6. Starting in Release 2.1.3, ARMv6 is not targeted when building for the iOS 6 SDK, or if the min iOS version is set to 4.3 or above.
To set the min iOS version for an application, add the min-ios-ver element to the application's tiapp.xml file:
<ios>
    <min-ios-ver>4.3</min-ios-ver>
</ios>

iOS 6 Contacts Changes
iOS 6 changed the way that applications access the device's contacts. As a result, Release 2.1.3 introduces a new API to check or request authorization to access contacts.
Use the new Ti.Contacts.contactsAuthorization property indicates whether the application is authorized to access contacts. It returns one of four values:
  • AUTHORIZATION_AUTHORIZED. The application can access contacts.
  • AUTHORIZATION_DENIED. The application doesn't have permission to access contacts.
  • AUTHORIZATION_RESTRICTED. The application doesn't have permission to access contacts, and the user does not have permission to change the application's status. The application should not attempt to reauthorize in this case.
  • AUTHORIZATION_UNKNOWN. Current authorization state is unknown, and the application should call the requestAuthorization method to request authorization from the user.
On iOS prior to iOS 6, and on Android, contactsAuthorization always returns AUTHORIZATION_AUTHORIZED.
For more information and sample code using the new APIs, see the Titanium.Contacts reference page.
iPhone 5 Assets and Splash Screens
For best results, existing applications should be updated with assets to fit the new iPhone 5 screen (1136 x 640 pixels) as needed. Assets specific to the new screen should be named with the suffix -568h@2x. For example, the default splash screen image for the new screen is named Resources/iphone/Default-568h@2x.png.
Grouped TableView Backgrounds
On iOS 6, using Titanium.UI.iOS.COLOR_GROUP_TABLEVIEW_BACKGROUND or 'stripped' as a color value no longer produces the standard group tableview background pattern. This is a change in iOS, and the corresponding iOS constant can no longer be used to specify the background texture.
Group style table views still default to using the standard iOS group table view background texture if no background color is specified. However, specifying one of these values explicitly on iOS 6 and above results in a black background color.
Modal Windows
On iOS 6, a modal window cannot be displayed in the upside-down portrait orientation. Attempting to open a modal window with UPSIDE_PORTRAIT as the only allowed orientation causes the application to crash.
YouTube Videos
As of iOS 6, embedded YouTube URLs in the form http://www.youtube.com/watch?v=oHg5SJYRHA0 no longer work. These URLs are for viewing the video on the YouTube site, not for embedding in web pages. Instead, use the embedded URL format described here: developers.google.com/youtube/player_parameters.

iOS Fixes and Enhancements
The following section lists all bug fixes and enhancements for the iOS platform.
Bug Fixes:
  • Build: Cannot build application for iOS with iOS SDK 5.1 on Xcode 4.4.1 (TIMOB-11076). This was a regression introduced in a Release Candidate build of Release 2.1.3, and does not occur in earlier 2.1._x_ releases.
  • Build: Console log reports minimum iOS version incorrectly when building with iOS 6 SDK using default tiapp.xml (TIMOB-11026). The builder correctly set the minimum iOS version to 4.3 when building with the iOS 6 SDK, but erroneously reported the minimum iOS version as 4.0.
  • Build: Log output from iOS 6 device builds does not appear in the Xcode 4.5 console (TIMOB-10831).
  • Build: DYLD_ environment variables being ignored because main executable (/usr/bin/osascript) is code signed with entitlements. (TIMOB-10243).
  • ButtonBar/ TabbedBar. When set as a title control, the button bar or tabbed bar does not automatically size to fit into the navigation bar on iOS 6 (TIMOB-10929). 
  • Color: Applying background color constant or "stripped" color to modal window results in the modal window being black (TIMOB-11030).
  • CommonJS modules: Improve error logging on non-exported CommonJS code. With this fix, the file name of the file generating the error is displayed correctly. Since JavaScript code in modules is compressed, the line number in the log output is not correct (TIMOB-10501).
  • Contacts: Ti.Contacts module doesn't work in iOS 6. This issue was caused by an API change in iOS 6 (TIMOB-11174, TIMOB-11199). The fix required the addition of new properties and a new method in the Ti.Contacts module. See iOS 6 Contacts Changes for details. 
  • iAds: Opening an iAD in landscape orientation & closing it crashes the application (TIMOB-11187). This issue only occurred when building with the iOS 6 SDK and running on iOS 6.
  • KitchenSink: No playback could be heard after recording audio. This was an issue in the sample code (TIMOB-10229).
  • Label: setting label text to empty string causes segmentation fault on iOS 6 (TIMOB-10810).
  • Log messages not showing up in Xcode 4.5 console when running on iPhone 4S with iOS 6 beta (TIMOB-10831).
  • Orientation - iOS 6 only: Forcing landscape on a window then opening an email dialog in portrait will result in your original window allowed to rotate to portrait (TIMOB-11213).
  • Packaging: App rejected for use of non-public API '_updateTitleView'. This regression was introduced in a previous release, and was caused by an internal method that shared the same name as a non-public iOS method (TIMOB-10678).
  • Map view. iOS 6 map view gives invalid region error under certain circumstances. (TIMOB-10892).
  • Map view: Repeatedly opening a tab group containing a map view crashes the application (TIMOB-10891). 
  • Picker: picker fails to update orientation on device rotate (TIMOB-11058). This was an issue with modal windows on iOS 6, which also affected other modal window types besides pickers.
  • Simulator: iOS Simulator always uses the default Xcode.app location, ignoring the location specified by xcode-select (TIMOB-10854).
  • Sound: Sound hanging on play from remote event (TIMOB-11065).
  • Splash screen: Default templates do not include iPhone 5 splash screen (TIMOB-10945).
  • Splash screen: On iPhone 5 simulator and potentially on iPhone 5, the correct splash screen is drawn then replaced by the @2x before app launch (TIMOB-11045).
  • Splash screen: On iPhone 5, the splash screen shows slight repositioning when application is launched (TIMOB-11150).
  • Splash screen: Update Titanium Mobile default template with iPhone-5 compatible splash image (TIMOB-10885).
  • TabGroup: activeTab returns the tab index instead of the tab object after setting active tab using setActiveTab. This appears to be a regression introduced after Release 2.0.2 (TIMOB-10796).
  • TableView - On a tableview using iOS TableViewStyle.GROUPED, the tableview's background color or image was not displayed (TIMOB-10998).
  • TableViewRow: className attribute returns TableViewRow object instead of the actual class name (TIMOB-11044).
  • TableViewRow: semi-opaque backgroundColor doesn't work correctly with title property (TIMOB-10474).
  • TextArea: Using Ti.UI.SIZE for a text area's height truncates the text included in the text area (TIMOB-9904).
  • TextField: Change event fired twice (once with wrong value) (TIMOB-9848).
  • TextField: Text field in scroll view is not positioned correctly after keyboard closes (TIMOB-11023, TIMOB-7998). This was a regression introduced in the 2.1._x_ branch.
  • Title control vanishes. If the root tab window has both a bar image and a title control set, and a window is closed, the root title control vanishes (TIMOB-11010).
  • VideoPlayer: When playing video in fullscreen mode then returning to non-fullscreen mode, the parent window is resized. (TIMOB-10864). This was a regression introduced in Release 2.1.2.
  • VideoPlayer: The video player is not displayed in fullscreen after setting the fullscreen proporties to in Ti.Ui.createVideoPlayer on iOS 6 (TIMOB-10928).
  • View: Implicit height calculation in vertical layouts are incorrect (TIMOB-10856).
  • View: View on window with vertical layout first drawn on centre of screen and then is re-drawn on top (TIMOB-11194). This was a regression introduced in a Release Candidate build of Release 2.1.3, and does not occur in earlier 2.1._x_ releases.
  • Window: Child window not opening if parent window has modal property set to true. Note that opening a window on top of a modal window is not recommended, but this issue has been fixed to ensure backwards compatibility with iOS 5 (TIMOB-10973).
  • Window: Orientation modes are neglected for second level child window (TIMOB-10972).
  • Xcode 4.5 preview: Building a project fails trying to target iOS 6 due to dropped ARMv6 support (TIMOB-10819). The ARMv6 architecture is no longer supported in iOS 6. With this fix, ARMv6 is not targeted when building for the iOS 6 SDK, or if the min iOS version is set to 4.3 or above.
    To set the min iOS version for an application, add the min-ios-ver element to the application's tiapp.xml file:
    <ios>
  •     <min-ios-ver>4.3</min-ios-ver>
  • </ios>
To browse this list in JIRA, see: Fixed iOS Issues in JIRA.

Android Fixes and Enhancements
The following section lists all bug fixes and enhancements for the Android platform.
Bug Fixes:
  • Application restarts when orientation changes and targetSdkVersion is 13 or higher (TIMOB-10863).
  • Build: Support selecting what ABI to target when using V8 runtime. (TIMOB-7474).
  • Button: image property is not working for density specific images (TIMOB-10806).
  • DatePicker: getValue throws an error, custom picker returns undefined (TIMOB-7313).
  • ScrollView does not scroll when layout is 'horizontal (TIMOB-10860). This issue was a regression in Release 2.1.2.
  • Slider: value not being set on creation on OS 4.0+ (TIMOB-10880).
  • Soft keyboard: In the KitchenSink Hide Soft Keyboard example, pressing the home button leaves the soft keyboard displayed (TIMOB-5077).
  • TableView: Border radius on TableView doesn't clip content (TIMOB-10166).
  • TableViewRow: Setting height to Ti.UI.SIZE on a TableViewRow causes the row to not display (TIMOB-8689).
  • View does not clip children to border (TIMOB-9469).
  • View: In 2.1.3 RC if borderWidth is used, show/hide on the border does not work and all views added on top will be hidden behind the border (TIMOB-11020). This issue was a regression in a Release Candidate build of Release 2.1.3, and does not occur in earlier releases.
  • View: Ti.UI.SIZE on width does not work with horizontal layouts (TIMOB-10812).
  • Window: android:back listener reacts when using Back key to dismiss keyboard (TIMOB-8648).
  • Window: Background image is not set correctly after changing the size of the window (TIMOB-10125).
  • Window: Lightweight window might not allow heavyweight window to focus (TIMOB-10809).
To browse this list in JIRA, see: Fixed Android Issues in JIRA.

Known Issues
During testing for this release, the following issues were discovered.
  • iOS: View on window with vertical layout first drawn at top left then at center (TIMOB-11203). This is a regression in Release 2.1.3.
  • iOS: App crashes on changing orientation while opening photogallery from modal window (TIMOB-11240). This issue is caused by a code error in the application -- when you open a gallery popover on iPad, you must give it a view to anchor to. This is not a new issue in Release 2.1.3.
    Improved error checking and documentation will be added in a future release to avoid this issue.
  • iOS: Black bar starts appearing below navBar when orientation changed between opening and closing of a window (TIMOB-11219). This is not a new issue in Release 2.1.3.
  • iOS: TableView: touchmove event is not fired (TIMOB-11103). This is not a new issue in Release 2.1.3.
  • iOS: Repeatedly opening a tab group containing a map view crashes the application on iOS 6 (TIMOB-10891). This issue is related to a change in the iOS native map view in iOS 6, which continues to render even when the map view is offscreen. To avoid this crash, remove the map view (or its parent) from the view hierarchy when it is offscreen.
The following issues reported in the Release 2.1.2 Release Notes are still open in Release 2.1.3:
  • Windows 7: Packaging fails for Android modules (TIMOB-10726).
    This issue has been reproduced with Titanium SDK 2.1.1 and 2.1.2. If you encounter this issue, make sure you have Python 2.6 or later installed and that the Python executable is in your search path.
  • Xcode 4.4/4.5: Xcode does not function as expected when installed on a partition other than the boot parition (TIMOB-10360).

2012/09/27

[Titanium mobile]Titanium が3.0になるぞー

Titanium mobile が、5ヶ月くらいで2回目のメジャーバージョンアップ。
勢いあるなー。
下の記事からの抜粋だけど、
大きなところで、
・iOS6に対応
・Alloyを正式なフレームワークベースに
・Android側の開発に本気を出す。

やっぱ、Androidにようやく本気になったっぽいところが非常にうれしい。
Androidのエミュレーターで起動するたびに二分くらい待ってたあの時間からやっと解放されます。
以下、下の記事のAndroidまわりの抜粋。
また、Titanium 2.0では、Androidのエミュレータの動作が遅く、機能も限定されていた。そのため、実機を使っての検証・デバッグが必要となり、アプリをビルドして転送、実行するのに時間がかかることが問題になっていた。しかし、次バージョンからは実機でのリモートデバッグに対応する。これにより、再ビルドなしでプログラムの変更と実行が可能になるという。Titanium 3.0ではまた、旧Mac OS X Mountain LionとiOS6、Android 4.1といった新しいプラットフォームにも正式対応する。





2012/09/19

[Titanium mobile]Phone向けのソースをAndroid向けに修正中

Titanium mobileでiPhone向けに作ったソースをAndroidで動くよう修正中なのですが、
ちょとハマったのがrequireで呼び出したJSからのグローバル変数の扱い。

iOSからは、参照可能
Androidからは、参照不可

挙動的には、iOS側の動きの方が便利だけど、仕組みとしては微妙だなと思ったら、 commonJS的にもAndroid側の挙動が正しいんだね。

そんだけです。

2012/09/13

[Titanium mobile]Androidでlabelオブジェクトに他のオブジェクトをadd

iOS向けの作ってたソースをAndroidに適用するときにハマったこと。

labelオブジェクトにlabelをaddすると真っ白になっちゃいます。

iOS側は問題なくうごくけどね。

なので、部品をまとめてコンポーネント的につかいたければ、土台はviewで作らないとだめ。

あと、borderWidthに関して、1以下を指定するとAndroid側は表示されない。

2012/08/31

[Titanium mobile]Androidアプリ開発してたらuncaught typeerror cannot call method 'replace' of null


Titanium mobileでAndroidアプリ開発してて今日のハマったこと。

Stringに大して、replaceをコールしたら以下のエラーが。

uncaught typeerror cannot call method 'replace' of null

iOSは問題なく動くんだけどー。

ソース的には、

var key ="a b(c)d";
alert( key.replace(/[ ¥(¥)]/g,"_") );

こんな感じで発生。

どうすっぺと悩んだけど、

var input = new String(key);
alert( input.replace(/[ ¥(¥)]/g,"_") );

ならちゃんと動きましたよー。

あんまり検証してないけど、メモとして残しておきます。

2012/08/21

[Titanium mobile] Androidアプリを作るぞと

そんなわけで、Titanium mobileでAndroidを開発してみてます。

Titanium mobileでiOS系の開発は、まぁ、ちょっと癖があるかなー程度な気もするけど、そのソースからAndroidもうごかしてみよーとなると、最初から意識して作ってないとものすごく、しんどいっす。

今日のはまったポイント。

Androidは、functionのなかに、ちょっとしたfunctionを作って、利用する際は 呼び出すまえで宣言されてないと怒られます。

だめな例
var hoge = hogehoge("a");
function hogehoge(input){ return input; }

これなら動く例
function hogehoge(input){ return input; }
var hoge = hogehoge("a");

単純に順番の話だけどね。

2012/08/20

[Titanium mobile]Android実機転送中に[ERROR] Error(s) compiling generated Java code

iPhoneでは大丈夫だったけど、Androidへ実機転送中に [ERROR] Error(s) compiling generated Java code なるエラーが。

原因は、i18nのstring.xmlの中身なのですが、 nameの中身に、 半角スペースはだめ、()な括弧もだめ。 -(ハイフン)や数字から始まるkeyもだめ。

'(シングルクオート)も/(スラッシュ)もだめでしたっと。 &もエスケープしててもだめでした。。。

 エミュレータだと別こけはしない。正しく読み込めていないみたいだけど。

エミュレーターと挙動が違うのはマジやめてほしい。