ABCalendarPickerのデモを動かしてみる
GitHub からダウンロードした「ABCalendarPicker-master」には、デモアプリのプロジェクトが入っている「Demo」フォルダがある。
この中に入っている「ABCalendarPickerDemo.xcodeproj」でデモアプリを動かすことができる。
が、いきなり「ABCalendarPickerDemo.xcodeproj」を開いて実機やシミュレータで実行しようとしても「ABCalendarPicker.bundle が無い!」と怒られて実行できない。
error: /Users/paraches/Library/Developer/Xcode/DerivedData/ABCalendarPickerDemo-ggxrsodybwufgdbbdewbdbsqsxai/Build/Products/Debug-iphonesimulator/ABCalendarPicker.bundle: No such file or director
ちゃんと見てみると、確かに ABCalendarPicker.xcodeproj の Products フォルダの ABCalendarPicker.bundle は赤い文字になっていて存在していない。
というわけで、まずは ABCalendarPicker のライブラリをビルドする必要がある。
それには schema を ABCalendarPickerAll に変更してから command+B でビルドする。
無事 ABCalendarPicker のビルドができると libABCalendarPicker.a と ABCalendarPicker.bundle の文字が黒くなる。
この状態で、scheme を ABCalenderPickerDemo に変更して適当な実行環境を選択、「Run」ボタンをクリックすれば実行できる。
ちなみに、iOS 5.x 以前の環境で実行しようとすると下記のような原因で落ちます。
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[EKEventStore authorizationStatusForEntityType:]: unrecognized selector
EKEventStore の authorizationStatusForEntityType: が "Available on iOS 6 and later." だそうです。