2011年10月22日土曜日

<備忘>証明書を設定できない?

証明書/プロファイルを更新したときに
command /usr/bin/codesign failed with exit code 1
でビルドエラーになったときの対応。
いろいろ検索して苦労したので。。。。。

 ・ビルドの設置が、期限切れの古い証明書を参照している。
     →BuildSettingで、設定し直す(Targetの同じ項目も設定し直す)

 ・古い証明書が残っていて、プロファイルと証明書の対応ができていない。
     →古い証明書を削除する。 ※本当に、ざっくり削除していいもの?
        キーチェーンで、古い証明書を削除する。
        ※見えないこともあるので、検索して残ってないかを確認する(検索窓に”iPhone"入れて検索)

http://icotfeels.blog66.fc2.com/blog-entry-3632.html
http://ynomura.blog47.fc2.com/blog-entry-665.html
http://ameblo.jp/iphone0126/theme-10021281850.html
http://technical-iphone.blogspot.com/2011/07/codesign-failed.html


 ・2台目のMacで証明書の設定しても、キーチェーンで証明書の秘密鍵が表示されない。
    →1台目のMacで設定済みの秘密鍵を書き出して、2台目のMacにインポートする。

  http://labs.karappo.net/iphone/index.php?itemid=274


2011年5月6日金曜日

iOS 備忘 音関連

音の鳴らし方。
大きく4種類あって、そのうち2つを書いておく
(I)
(1)ファイルを指定して準備
AudioServicesCreateSystemSoundID()

(2)鳴らす
- AudioServicesPlaySystemSound();
- AudioServicesPlayAlertSound()
↑バイブレーション付き

(3)後始末
AudioServicesDisposeSystemSoundID(soundFileObject);

・利点
わりと簡単に音を出せる。(でも後述の方法とさほど変わらない。。。)
・欠点
ボリュームの調整ができない。
iPhoneのボリューム設定と連動しない
(ミュートスイッチがONなら、鳴らない)

ちなみにバイブレーションのみは、
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);


(II)
(1)ファイルを指定してインスタンスを作成
AVAudioPlayer *soundPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:&error];

(2)準備
[soundPlayer prepareToPlay];

(3)鳴らす
[soundPlayer play];

(4)途中で止める
[soundPlayer stop];

stopの後にplayすると、止めたところから再生されるので、頭出しするには、
soundPlayer.currentTime = 0;

???
[soundPlayer stop];
すると、バッファがクリアされるので、
[soundPlayer prepareToPlay];
が必要?未確認。



(5)後始末
[soundPlayer release];

・利点
iPhoneのボリューム設定と連動する。
途中で音を止められる。
・欠点
(比較的)指定が面倒?

2011年1月1日土曜日

iOS 備忘 applicationDidFinishLaunching

iOS3.2以降は、

- (void) applicationDidFinishLaunching:(UIApplication *)application

の代わりに

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

が用意されているので、didFinishLaunchingWithOptionsにアプリケーション起動直後の処理を描くこと