This comment is reply for 3948 Psychs: AppKit のリンクが必要です。 (HTTPでGET). Go to thread root.
Psychs #3950(2007/11/13 13:11 GMT) [ Objective-C ] Rating2/2=1.00
release をちゃんと入れました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#import <Foundation/Foundation.h> #import <Appkit/Appkit.h> @interface AppController : NSObject { NSURLConnection* connection; } @end @implementation AppController - (void)dealloc { if (connection) [connection release]; } - (void)startRequest { NSURL* url = [NSURL URLWithString:@"http://ja.doukaku.org/feeds/comments/"]; NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]; [req setHTTPMethod:@"GET"]; connection = [[NSURLConnection alloc] initWithRequest:req delegate:self]; } - (void)connectionDidFinishLoading:(NSURLConnection*)conn { [NSApp terminate:self]; } - (void)connection:(NSURLConnection*)conn didFailWithError:(NSError*)err { NSLog(@"error"); [NSApp terminate:self]; } - (void)connection:(NSURLConnection*)conn didReceiveData:(NSData*)data { NSLog([[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]); } @end int main(int argc, char** argv) { id pool = [NSAutoreleasePool new]; [NSApplication sharedApplication]; id controller = [[[AppController alloc] init] autorelease]; [controller startRequest]; [NSApp run]; [pool release]; return 0; }
Rating2/2=1.00-0+
[ reply ]
Psychs
#3950()
[
Objective-C
]
Rating2/2=1.00
Rating2/2=1.00-0+