2. iPhone SDK 勉強会 参考URL iOS App Development Workflow Guide http://developer.apple.com/library/ios/#documentation/Xcode/ Conceptual/ios_̲development_̲workflow/135-‐‑‒Unit_̲Testing_̲Applications/ unit_̲testing_̲applications.html
初めまして。プログラマのショウといいます。 現在、mixiの公式iPhoneアプリを担当しています。 今回は、iPhoneアプリ開発におけるGHUnitを用いた単体テストについて紹介したいと思います。 ★ テストとは 本題に入る前に少しだけ、テストという概念について整理してみましょう。 ソフトウェアを開発する上での「テスト」という言葉は、「コンピュータのプログラムを実行し、正しく動作するかを確認する作業のこと」を指します。 そしてこの「正しく動作するかを確認する方法」として主に以下の2通りがあります。 ・ ホワイトボックステスト ・ ブラックボックステスト ホワイトボックステストとは、「命令網羅」「分岐網羅」「条件網羅」などの方式を用いて、プログラム内部の動作がプログラマの意図通りとなっているかを確認するものとなります。 これに対してブラックボックステストとは、プログラム内部に関係なく、外
プログラミング (iOS, JavaScript, Jenkins, Sikuli) とMacやiPhoneなどの話題が中心のブログ 先日、ATOK Pad for iPhoneを購入しました。開発者向け情報のページに他のアプリケーションとの連携が可能なことが書かれていたからです。そのページによると、ATOK PadのカスタムURLスキームとペーストボードを利用するようですが、どちらもプログラミングで利用したことがなかったので、まずカスタムURLスキームについて調べてみることにしました。 この記事ではObjective-CからカスタムURLスキームを利用して他のアプリケーションを起動する方法について述べます。当然のように、XcodeとiOS SDKは導入済みであるとします。 カスタムURLスキーム(Custom URL schemes)とは 他のアプリケーションを利用するための方法です。U
2012/05/08 version 1.0.2 メモリの最適化、連続変換に対応 2011/07/15 version 1.0.1 アイコンを微調整 2011/06/13 version 1.0.0 初版公開 2012/05/08 version 1.0.2 adjust memory, can repeat the run 2011/07/15 version 1.0.1 adjust the icon a little 2011/06/13 version 1.0.0 released CSV2Plist はiOSやMacディベロッパー向けのアプリで、CSV形式のファイルをplist形式のファイルに変換するツールです。plist形式とは、iOSやMacアプリで用いられるファイル形式で、通常、アプリの設定ファイルはplist形式で記述します。しかしplist形式のファイルは編集するのが少
前の記事で予告した通り、今度はNSRegularExpressionの話。 正規表現でマッチした部分文字列を取得する まずNSRegularExpressionオブジェクトを作って、それのメソッドにNSStringのオブジェクトを渡す、という形で使う。まぁ説明するよりコード見た方が早い。 NSString *string = @"「そんな正規表現で大丈夫か?」「大丈夫だ、問題ない」"; NSError *error = nil; NSRegularExpression *regexp = [NSRegularExpression regularExpressionWithPattern:@"「そんな(.+)で大丈夫か?」「(.+)」" options:0 error:&error]; if (error != nil) { NSLog(@"%@", error); } else { NST
Xcode 4.4 から Objective-C が書きやすくなりました、という今更のいまさらな話ですが、ネット上に転がっている少し前のサンプルソースなどは古い書き方のものもあるようなので、今回はよく使う NSArray と NSDictionary と NSNumber の書き方についてだけ備忘録として残しておこうと思います。 NSArray インスタンスの生成 // 古い書き方 NSArray *oldArr = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil]; NSMutableArray *oldMutableArr = [NSMutableArray arrayWithObjects:@"value4", @"value5", @"value6", nil]; // 新しい書き方 NSArray *n
まえ別のブログで書いたのですが、こちらにも書いておきたかったのでメモっときます。 次のようなArrayの中にDictionaryがいくつか入っている構成のデータがあったとします。 [plain] ( { name = "wicket"; id = 1; }, { name = "oyabunn"; id = 2; }, { name = "apple"; id = 3; }, ) [/plain] ここから、id = 1 のdictionaryのデータを取り出す方法、 name = wicket のDictionaryを取り出す方法のお話です。 さて、まずid = 1 のDictionaryを取り出すときを考えてみます。 普通に考えて、id順に並んでいるようですからobjectAtIndex:関数を使って取り出すことができます。 では次に、name = wicket のデータを取り出す方法
たとえば、CIFilterを使っていて、下記のようにinputImageに値(画像)を渡そうとしていて、 [filter setValue:_filteredImage forKey:@"inputImage"]; この filter が inputImage というプロパティを持たないものだったとき(たとえば CICheckerboardGenerator)に、こんなエラーが出ます。 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inputImage.' 解決法はこちらにとてもわかりやすく詳細な記事があって、以下は単なるその抜粋になります。 何が起きているのか? setValue:ForKey:
iPhoneアプリで位置情報と地図を使うための基礎知識:iOSでジオ(GEO)プログミラング入門(1)(1/3 ページ) 利用が加速するジオ(GEO)メディアを使いこなそう 最近、携帯電話端末(ケータイ、ガラケー、フィーチャーフォン)やスマートフォンなどのモバイル端末での位置情報・ジオ(GEO、Geographical)メディアの利用が加速しています。 多くのソーシャルサービスは、位置情報付きで投稿する機能を備えていて、チェックイン系のサービスも人気です。位置情報を利用したAPIも多く公開されており、マッシュアップによって個人でも面白い位置情報アプリを作成できます。 本連載では、iOS(iPhone/iPad/iPod touch)で動く「現在地の近辺で撮影された写真を地図上に表示するアプリ」を作りながら、位置情報アプリを作成するための「測位機能の取り扱い」「地図の取り扱い」「サーバとの通
CoreLocationサンプル1 - 現在位置の取得と領域観測 | ラベル: iOS, Objective-C, サンプルコード Tweet 今回もiOSデバイスが持っている機能を利用するものとして、位置情報サービスについて進めてゆきます。 iOS Developer Libraryの「位置情報対応プログラミングガイド」(英語版はMaking Your Application Location-Aware)に沿って、サンプルを公開します。 注意点カメラ・加速度センサー・ジャイロスコープ・磁力センサーなどのハードウェアを利用する場合とは、以下の点で異なります。 位置情報サービスを利用する場合は、ユーザに確認を取らなければならない 確認用のダイアログはフレームワークが自動的に表示してくれます。必要になる直前に確認するようにしなければ、ユーザが「なぜその機能が必要なのか?」という懸念を
iOSアプリ(Objective-C)を書き始めて半年たったので、それまでに触ったりした開発ツールやObjective-Cのライブラリなどについてまとめてみる。 AppCode 個人的にはXcodeより好きなので、コードを書く時は基本的にAppCodeで書いていた。 デバッガー周りやエラー表示についてはXcodeの方いいところが多いので、Xcodeも併用する。(どっちにしてもxibやData ModelをいじるときにはXcodeが必要な気がするので両方共起動してる事が多かった) AppCodeはリファクタリングやXcodeでAnalyzeとかしなくてもメモリ解放忘れとかわかるのと、Quick fix(Alt+Return)がすごく便利なので書くときにリズムを生むのに役立った。 WebStormも使っているので同じ系統のIDEに慣れているのもあるけど、JavaScript書いてる時よりObj
UIViewやUIImageなどを扱う時、よくCGRectやCGSizeをLogに書きだしたりしたくなることがあります。 そんなとき、毎回 [objc] NSLog(@"rect : %f %f %f %f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); [/objc] と書くのはかなり手間です。 文字が長いので、書くだけで気合いを使い果たしてしまいそうです。 マクロで定義しちゃえば簡単に書けるようにはなりますが、あまりマクロに詳しくない人もいると思います。 そこで、Appleが準備しているほうのマクロを紹介しようと思います ■NSStringFromXXXマクロ NSStringにはNSStringFromXXXといったタイプのマクロがあります。 これらを使うと、 [objc] NSLog(@"rect :
プッシュ通知を実装するときに、「バックグラウンドで通知受けたときはapplication:didFinishLaunchingWithOptions:とapplication:didReceiveRemoteNotification:、どっちが呼ばれるんだっけ?」とかなんだかいつも自信なくなってきてドキュメントを見返したりしてしまうので、ドキュメントと、実際の動作を確認した内容をまとめておきます。 (参考ドキュメント) Local Notification および Push Notification プログラミングガイド(日本語) (英語・最新版) アプリがバックグラウンドで動作中に通知が配信された場合の挙動 この場合、システムは、警告の表示、アイコンのバッジの表示、また、サウンドの再生を行う ことで通知を提示します。 アクションボタンがタップされると、システムはアプリケーションを起動しま
FacebookやTwitter、LINEなど多くのサービスで使われている PUSH通知機能を実装してみます。 証明書の準備やサーバ側の実装などの説明は省きますので、 詳細に知りたい方はこちらをご参考下さい。 iPhoneアプリにPush通知機能を実装する方法のまとめ - もとまか日記 【2013/5/6 追記】 PUSH通知の証明書準備編の記事書きました。 PUSH通知機能を持ったiPhoneアプリを作る(証明書の作成) デバイスの登録 「デバイストークン」をサーバ側へ送信します。 PUSH通知を送る際には、このデバイストークンを指定してメッセージを送ります。 // アプリ起動時 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOpti
Objective-Cランタイムシステムを直接操作して、iOS 5から新しく追加されたメソッドをiOS 4で動かしたときにも使えるようにしてしまえ、という話です。 例題:parentViewController問題 iOSでUIViewController「親」からUIViewController「子」をモーダル表示したとき、これまでは子のparentViewControllerに親が格納されていましたが、iOS 5からはそれがnilになって、代わりに新しくできたpresentingViewControllerに格納されるようになりました。iOS 5からUIViewControllerにコンテナ機能が追加されたので、その辺色々整理されたのでしょうか。 参考:http://cocoa.hatenablog.com/entry/2011/11/24/222140 なので子から親を呼びたい場合、
2013年4月4日木曜日 objective-CでのHTTPリクエストの簡単なサンプル 手っ取り早く言ってしまうと、サーバーと通信するための簡単なプログラムです。 形式は決まっているのに、なかなか覚えないためメモ NSString *query = [NSString stringWithFormat:@"id=%@&date=%@", user_id, date]; NSData *queryData = [query dataUsingEncoding:NSUTF8StringEncoding]; NSString *url = @"http://localhost/social-alarm/sample.php"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]init]; [request setURL:[
以下のような方法でURLエンコード/デコードできると書かれているサイトが沢山あるが、大嘘つきもいい所だ。特殊文字を取りこぼしまくってる。 //encoding NSString *escapedUrlString = [plainString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; //decoding NSString *decodedUrlString = [escapedUrlString stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; 多分これで全部フォローできていると思うが、もし足りない文字があればコメントで教えて欲しい。 //encoding NSString *escapedUrlString =
ここにまとまってました。 Specifier Description %@ Objective-C object, printed as the string returned by descriptionWithLocale: if available, or description otherwise. Also works with CFTypeRef objects, returning the result of the CFCopyDescription function. %% '%' character %d, %D, %i Signed 32-bit integer (int) %u, %U Unsigned 32-bit integer (unsigned int) %hi Signed 16-bit integer (short) %hu Unsigned 16-bi
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く