要發送的數據
舉例POST方法:
url = @"https://api.dropbox.com/<version>/account/"
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:value forKey:@"callback"];
舉例GET方法(網址查詢):
NSString *urlString = [[[NSString alloc] initWithString:@"https://api.dropbox.com/<version>/account/info
"] autorelease];
urlString = [urlString stringByAppendingFormat:@"?callback=whatever&status_in_response=something"];
NSURL *url = [[NSURL alloc] initWithString:urlString];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestDidFinishForThreadID:)];
[request startAsynchronous];
要檢索的JSON值,並將其轉換成字典
SBJsonParser *json = [[SBJsonParser alloc] init];
NSDictionary *dict = (NSDictionary*)[json objectWithString:responseString];
您需要JSON框架:http://code.google.com/p/json-framework/
而且還ASIHTTPRequest:http://allseeing-i.com/ASIHTTPRequest/
未與Dropbox的測試,但應該是這個樣子。