2012年10月19日金曜日

AWSトレーニング

仕事の関係でAWSのトレーニングを受講。
2日でEC2, AMI, RDS, S3, IAM, ELB, AutoScaling, CloudFormationあたりをぐぉーっとやるので、ハンズオンは結構大変なものもあった(Linuxは良いんだけど、Windowsを使うと....慣れてないので)。

本を読んだり自分で触っているだけだと今ひとつ漠然としていたサービスの全体が少しクリアになった感じ。あと、すごい課金がくるんじゃないかとビクビクしてたけどこれからはあんまり怯えないで使えそう ^^;; 仕事で使う予定はないけど、テスト用サーバとか作ったりして遊びたい。

Webベースで操作をするとちょっといらっとするので、APIの勉強もしようかな。

2012年4月3日火曜日

iPhoneでYouTube(その2)

先日の投稿で書いた通りにやると、うまくいかなくなってしまった。gdata-objectivec-clientにSBJSonが入らない状態でダウンロードされるためと思われる。 で。こんな感じで回避。

1. svn checkout http://gdata-objectivec-client.googlecode.com/svn/trunk/ gdata-objectivec-client-read-only

これでSBJSonの入っていないgdata-objectivec-clientが取得できる。

2.ここからさらにダウンロード。 

2に入っているJSONフォルダを1のSourceにコピー。

そのあとはここで紹介されている手順で作業。

もしかしたら2つめにダウンロードしたやつだけでうまくいくのかもしれない....と後で思った。

2012年2月10日金曜日

iPhoneのPush

とりあえず、SandBox使用の場合

1) App IDではちゃんと開発用のPushの設定をしておく
2) Pushが使えるProvisioningで署名をする
3) 1. で取得した証明書とか秘密鍵でp12ファイルを作って、サーバーにおいておく

3を忘れてひどい目にあったので、めもめも。

2012年2月8日水曜日

YouTube API for Objective-C(iPhone)

設定はここを見れば、大体問題なし(YouTube APIになっていないところは、適宜直す)。

xxx.hでは
#import "Headers/GDataYouTube.h"
#import "Headers/GDataServiceGoogleYouTube.h"

を記述した上で、プロパティにGDatFeedYouTubeVideo*を設定しておく。

特定ユーザのフィードを検索するにはviewDidLoadあたりで

    GDataServiceGoogleYouTube *service = [self youTubeService];
    NSURL *feedURL = [GDataServiceGoogleYouTube youTubeURLForFeedID:nil];
    GDataQueryYouTube* query = [GDataQueryYouTube 
            youTubeQueryWithFeedURL:feedURL];
    [query setStartIndex:1];
    [query setMaxResults:5];
    [query setAuthor:@"ユーザ名"];
    [query setOrderBy:@"published"];
   
    [service fetchFeedWithQuery:query delegate:self
          didFinishSelector:@selector(request:finishedWithFeed:error:)];
   
    [super viewDidLoad];       


とやっておく。

youTubeServiceは
- (GDataServiceGoogleYouTube *)youTubeService {
    static GDataServiceGoogleYouTube* _service = nil;
    if (!_service) {
        _service = [[GDataServiceGoogleYouTube alloc] init];
        [_service setUserAgent:@"てきとうに"];
    }
   
    // fetch unauthenticated
    [_service setUserCredentialsWithUsername:nil  password:nil];
    return _service;
}

検索が終わったら
- (void)request:(GDataServiceTicket *)ticket
finishedWithFeed:(GDataFeedBase *)aFeed
          error:(NSError *)error {
    if (!error) {
        [self setFeed:(GDataFeedYouTubeVideo *)aFeed];   
        [self.listView reloadData];
    }
}

みたいにして、検索結果をプロパティに設定して、UITableViewを更新する。
タイトル文字列なんかは
    GDataEntryBase *entry = [[feed entries] objectAtIndex:indexPath.row];
    NSString *title = [[entry title] stringValue];
    NSString *descriotion =
   [[[(GDataEntryYouTubeVideo *)entry mediaGroup]
               mediaDescription] contentStringValue];
    NSArray *thumbnails =
   [[(GDataEntryYouTubeVideo *)entry mediaGroup] mediaThumbnails];


こんな感じでとれる。

ここから基本的なコードは取得できる。