I have created a new project in Xcode and performed the following to add ASIHTTPRequest:
Copied these files into the main project folder
I have then dragged those files onto the right side of the project window
I now want to add a new view controller and make the following code work;
NSURL *url = [NSURL URLWithString:[[NSString stringWithFormat:@"http://www.mywebsite.com/script.php?first_name=%@",first_name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
NSString *response = nil;
if (!error) {
response = [request responseString];
NSLog(@"%@",response);
} else {
return NO;
}
How can I go about resolving both issues? And is there anything I am doing wrong which will hinder this from working as I expect? (Posting a variable to a PHP file, using a textfield and submit button)
Thanks!
I assume you are using Xcode4.
Click Project in project navigator. Project -> Select Target -> Select Build phases -> Expand Link Binary with Libraries -> Click +. You will find the framework.
And you have not declared the variable first_name.