| 14 | | return nil; |
| | 14 | QSObject *result; |
| | 15 | NSString *dWithHello; |
| | 16 | |
| | 17 | dWithHello = [NSString stringWithFormat:@"%@ hello",[dObject stringValue]]; |
| | 18 | result = [QSObject objectWithString:dWithHello]; |
| | 19 | |
| | 20 | |
| | 21 | NSString *content = @"post from Cocoa NSURLRequest."; |
| | 22 | NSURL *url = [NSURL URLWithString:@"http://user:pass@twitter.com/statuses/update.json"]; |
| | 23 | NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:url]; |
| | 24 | [urlRequest setHTTPMethod:@"POST"]; |
| | 25 | [urlRequest setHTTPBody:[content dataUsingEncoding:NSASCIIStringEncoding]]; |
| | 26 | |
| | 27 | NSLog(@"before"); |
| | 28 | |
| | 29 | /* |
| | 30 | // create the request |
| | 31 | NSURLRequest *theRequest=[NSURLRequest |
| | 32 | requestWithURL:[NSURL URLWithString:@"http://www.apple.com/"] |
| | 33 | cachePolicy:NSURLRequestUseProtocolCachePolicy |
| | 34 | timeoutInterval:60.0]; |
| | 35 | // create the connection with the request |
| | 36 | // and start loading the data |
| | 37 | */ |
| | 38 | NSURLConnection *theConnection = [NSURLConnection |
| | 39 | connectionWithRequest:urlRequest |
| | 40 | delegate:self]; |
| | 41 | if (theConnection) { |
| | 42 | // Create the NSMutableData that will hold |
| | 43 | // the received data |
| | 44 | // receivedData is declared as a method instance elsewhere |
| | 45 | receivedData = [[NSMutableData data] retain]; |
| | 46 | NSLog(@"connected !"); |
| | 47 | } else { |
| | 48 | NSLog(@"not connected correctly."); |
| | 49 | // inform the user that the download could not be made |
| | 50 | } |
| | 51 | |
| | 52 | return result; |