ラベル objective-c の投稿を表示しています。 すべての投稿を表示
ラベル objective-c の投稿を表示しています。 すべての投稿を表示

2012年3月27日火曜日

CAEmitterCell のパクリネタ

ネタが無いので、パクリました。_( TxT)_

Emitting (発光 by Google 翻訳先生) のパクリネタ

本家を読んでくださいね。

パクリ元

UIKit Particle System in iOS 5 Tutorial

参考という名目のパクリ元

CAEmitterLayer and CAEmitterCellアップるぅぅぅの記事ですよね

その他ぽいの


プロパティの説明

CAEmitterCell
birthRate毎秒どれくらいオブジェクトを作るか
lifetimeセルのライフタイム
colortint 色合いを設定
contentsCGImageRef を設定


Layer は emitterShape と emitterPosition を設定するくらいでしょうか

CAEmitterLayer
emitterShapeオブジェクトの作成方法を設定

動かすとこんな感じ


使った適当な画像はこれです


ソース

ファイルのコメント的にはコピペはOKそうだったのですが。
問題ありましたらご指摘ください

2012年1月25日水曜日

続 NSURLConnectionDelegateで証明書(ry..方法

前回の記事が適当すぎたので、少ししっかり調べたーー

参考になると幸いです

結論

SSL周りのリリースノート、仕様書とかきちんとでてますか?

知っている方いたら教えてください

環境

  • iOS 5.0
  • tomcat 7.0.23 / 6.0.32
  • xcode 4.2.1

適当にする方法(改め)

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
  NSURLProtectionSpace * protectionSpace = [challenge protectionSpace];
  NSURLCredential* credentail = [NSURLCredential credentialForTrust:[protectionSpace serverTrust]];
  [[challenge sender] useCredential:credentail forAuthenticationChallenge:challenge];
}

ハマった事

結論

RSAはOKでDSAはNG

ハマっている世界

iOS 5.0 は 証明書に MD5 を非サポートになったので、

keytool のデフォルト動作だと MD5withRSA なので

自己証明のSSL通信が軒並み エラーになると思っていた

SHA1withRSA とかkeystoreを作り直すと上のコード動いたと勘違いした。

安心したので,MD5の証明書でもやってみたら案の定動作したので、アレ?と思い

DSA で作成したら軒並みエラーなった。

--- 以上 ----

エラーの違い

xcode: Console

SHA1withRAS, MD5withRAS

SHA1withDAS

iPad : Safari : RSA

iPad : Safari : DSA

証明書一部

2012年1月23日月曜日

NSURLConnectionDelegateで証明書周りを適当にする方法

自己証明書だと、通信に失敗するでの軒並みOKにするには下のコードで行ける!!

おすすめはしない!!

※ コマンドラインでしか試してません ※


- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
  return YES;
}

- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection {
  return YES;
}

- (void) connection:(NSURLConnection *)conn didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
  NSURLProtectionSpace * protectionSpace = [challenge protectionSpace];
  NSURLCredential* credentail = [NSURLCredential credentialForTrust:[protectionSpace serverTrust]];
  [[challenge sender] useCredential:credentail forAuthenticationChallenge:challenge];
}

リンク

参考またはこうすべきサイト

サンプルコード

2011年10月12日水曜日

Objective-C on Ubuntu 寄り

ここら辺は役に立つ模様の話

Objctive-c
http://developer.apple.com/jp/documentation/cocoa/Conceptual/ObjectiveC/index.html
HeaderDoc
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/HeaderDoc/intro/intro.html
GuideLine
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html
Style Guide
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml

コンパイル周りの話

ubuntu では
gcc -lobjc -lgnustep-base -fconstant-string-class=NSConstantString \
      -I /usr/include/GNUstep -o xxxx ...
って感じなのだが mac では
gcc -framework Foundation -o xxxxx ...
となる

Ubuntuではまったところの話

@property を使用するためには、gcc 4.6 以降が必要らしい。(まだ未確認)
apt-get では取得できないので、ソースからビルドになります。
必要になるライブラリ(おそらく configure のオプションで OFFにしておけば必要ない。Offにできるかは未確認)
sudo apt-get install libgmp3-dev libmpfr-dev libmpc-dev
ビルド
gcc-4.6.1/   ソースディレクトリ
build-gcc/   ビルドディレクトリ
ビルドディレクトリにて
../gcc-4.6.1/configure --prefix=your_specified_path \
                               --exec-prefix=your_specified_path
make -j 3
make install