我正在尝试将 ASIHTTPRequest 包装器应用于一个非常基本的 Objective C 程序。我已经将必要的文件复制到我的程序中,在试图弄清楚它是如何通过他们的网站工作的让自己非常头疼之后,我想我会在这里发布一个问题。复制过来的文件是:
ASIHTTPRequestConfig.h
ASIHTTPRequestDelegate.h
ASIProgressDelegate.h
ASIInputStream.h
ASIInputStream.m
ASIHTTPRequest.h
ASIHTTPRequest.m
ASIFormDataRequest.h
ASIFormDataRequest.m
我的程序非常基本:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// Defining the various variables.
char firstName[20];
char lastName[20];
char rank[5];
int leaveAccrued;
int leaveRequested;
// User Input.
NSLog (@"Please input First Name:");
scanf("%s", &firstName);
NSLog (@"Please input Last Name:");
scanf("%s", &lastName);
NSLog (@"Please input Rank:");
scanf("%s", &rank);
NSLog (@"Please input the number leave days you have accrued:");
scanf("%i", &leaveAccrued);
NSLog (@"Please input the number of leave days you are requesting:");
scanf("%i", &leaveRequested);
// Print results.
NSLog (@"Name: %s %s", firstName, lastName);
NSLog (@"Rank: %s", rank);
NSLog (@"Leave Accrued: %i", leaveAccrued);
NSLog (@"Leave Requested: %i", leaveRequested);
[pool drain];
return 0;
}
如何利用包装器通过 http 请求将这 5 个基本变量导出到 Web 服务器?