iphone app 公開後の経過

iphone app を公開して1週間が経ちました。

Market Units Change
1. USA 982 982 (100)%
2. Japan 227 227 (100)%
3. Canada 133 133 (100)%
4. Korea, Republic Of 12 12 (100)%
5. UK 12 12 (100)%
6. Australia 8 8 (100)%
7. Germany 6 6 (100)%
8. Spain 3 3 (100)%
9. Italy 3 3 (100)%
10. Greece 3 3 (100)%

なんとアメリカで約千ダウンロード!!

スピードガンアプリなので、やはり野球大国アメリカすごいということか、
もしくは、iphoneの普及率が日本より多いのか?

それはわからないけれどとてもうれしいかぎりです。

第二弾は構想段階ですが、業務が少し落ち着いたらまた作成しようかと思います。




simple speed gun
Simple Speed Gun

iphone app で警告を利用する

wwdc2011が今日からですね。ios5の発表っもあるとか..
ただ、まだまだそんなレベルでないので、地道に少しずつ。
iphoneアプリで警告を表示したい場合。

clickedButtonAtIndex

- (IBAction) refreshAll{
	NSLog(@"refreshAll%@",@"_in");	
	// 1行で書くタイプ(複数ボタンタイプ)
	UIAlertView *alert =
	[[UIAlertView alloc] initWithTitle:@"Refresh" message:@"clear your result?"
							  delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
	[alert show];
	NSLog(@"refreshAll%@",@"_out");
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {  
	NSLog(@"clickedButtonAtIndex%@",@"_in");
	if (buttonIndex == 1) {
		aveMph = 0;
		aveKmh = 0;
		counter = 0;
		[results removeAllObjects];
		[self showCounters];
	}  
	
	[alertView release];  
	NSLog(@"clickedButtonAtIndex%@",@"_out");
} 

buttonIndexは左から0,1,2...となるそう。

iphone app で警告を利用する

wwdc2011が今日からですね。ios5の発表っもあるとか..
ただ、まだまだそんなレベルでないので、地道に少しずつ。
iphoneアプリで警告を表示したい場合。

clickedButtonAtIndex

- (IBAction) refreshAll{
	NSLog(@"refreshAll%@",@"_in");	
	// 1行で書くタイプ(複数ボタンタイプ)
	UIAlertView *alert =
	[[UIAlertView alloc] initWithTitle:@"Refresh" message:@"clear your result?"
							  delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
	[alert show];
	NSLog(@"refreshAll%@",@"_out");
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {  
	NSLog(@"clickedButtonAtIndex%@",@"_in");
	if (buttonIndex == 1) {
		aveMph = 0;
		aveKmh = 0;
		counter = 0;
		[results removeAllObjects];
		[self showCounters];
	}  
	
	[alertView release];  
	NSLog(@"clickedButtonAtIndex%@",@"_out");
} 

buttonIndexは左から0,1,2となるそう。

おしまい。

iphone app の申請をする

作成したiPhone アプリの申請を行う。

1)
 1.ローカルで認証キー
  アプリケーション>ユーティリティ>キーチェーンアクセスを起動する。
 2.プルダウンメニューの「キーチェーンアクセス」から「証明書アシスタント」の中にある「認証局に証明書を要求」を選択。
3.証明書情報にiphone Developerで登録したメールアドレスと名前を入力し、「ディスクに保存」をチェック、「鍵ペア情報を指定」をチェックし「続ける」をクリック。
4.鍵ペア情報で「2048ビット」「RSA」を書くんんして、「続ける」をクリック。続いてファイル名を指定して保存します。CSRファイルが保存される。
5.Certificate > Distribution downloadをクリック
6.「ファイルを選択」をクリックし上記1.で保存した「CSR」ファイルを選択し、「submit」をクリックする。
7.Action」の「download」をクリック。「developer_identity.cer」をダウンロードし、実行してキーチェーンアクセスに登録する。

2)配布ようのプロビジョニングの作成とダウンロード
1.IDP でProvisioning → Distribution → New Profile
2.App Storeを選択し、Nameは好きな名前を入力。App Idは選択式で選択。
3.Download し、ダウンロードしたファイルを実行。
4.xcodeのプロジェクトタブのプロジェクト設定の編集をクリックし、構成でreleaseを選択して複製をクリック。そして名前をDistributionに変更
5.ビルドタブでDistributionを選択して、Any iPhone OS Deviceを作成したprovisioningに変更する。
6.DeviceでDistributionを選択してビルドする。
7.ここでエラー「appears more than once in the keychain. The codesign tool requires there only be one」
  キーチェーンに重複して登録しているらしいので、古い方を削除して再実行。
 8.アプリフォルダのbuild内のDistribution-iphoneosに.app.dSYMという拡張子と拡張子がないもができている。この拡張子がないものを圧縮。

3)
1.IOS dev center を表示し、iTunes Connectを選択。
2.必要事項を記載する。
3.xcodeのオーガナイザへbuild and archiveを実行すると自動的に移動する。それをvalidateしてsubmit。

iphone app でsqliteを利用したい

アプリケーションの結果を保存したい。
調べたところ、coredataというものがiphoneフレームワークには備わっているらしい。

ただ、なんとなく敷居が高そうなので、まずはsqliteで実装してみる。

ターミナルでsqliteを起動する。

sqlite3 database.sqlite

コンソールに戻る場合はquit。

.quit

まず、データベースファイルを作成する。

sqlite3 srGunDB.sqlite
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

.database とコマンドを打つ。

sqlite> .database
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /Users/brackpanda/srGunDB.sqlite 
create table category(
   'id' integer,
   'title' text,
   'date' text
);

create table detail(
    'categoryId' integer,
    'no' integer,
    'speed' text,
    'speedLabel' text,
    'distance' text,
    'distanceLabel' text
);

.schemaと打つことで確認することができる

.schema

これで、テーブルの準備は完了。