www.parse.com 与 ASIHTTPRequest 结合使用的小笔记

 1     static NSString * const kBaseURLString = @"https://api.parse.com/1/classes/";
 2     static NSString * const kApplicationId = @"crnWx2nN6KftGsqO1HnKiAZN9qSSqipKt3mnctK8";
 3     static NSString * const kKey = @"Mijt8NVFbycEH1nAq57BcG0t2F6KXMY4KGWF6SEg";
 4 
 5     NSString *url = [NSString stringWithFormat:@"%@%@", kBaseURLString, @"Birthday"];
 6     ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:url]];
 7     
 8     [request addRequestHeader:@"X-Parse-Application-Id" value:kApplicationId];
 9     [request addRequestHeader:@"X-Parse-REST-API-Key" value:kKey];
10     [request setRequestMethod:@"GET"];
11     
12     [request setDelegate:self];
13     [request setTimeOutSeconds:15.0];
14     [request setDidFinishSelector:@selector(requestDone:)];
15     [request setDidFailSelector:@selector(requestError:)];
16     [request startAsynchronous];

方便自己查询,备用。注意代码中的粗体部分(重点)。

posted @ 2012-09-19 17:34  流浪的剑客  阅读(1076)  评论(0)    收藏  举报