TigerのNSData:dataWithContentsOfURLは?
Posted 3月 27th, 2009 by hippos
in
clippyのtiger版テストをしていて気がついたのだけれどTigerのNSData:dataWithContentsOfURLはちょっと問題がありそう。
NSData *d = [NSData dataWithContentsOfURL:
[NSURL URLWithString:@ "http://www.yahoo.co.jp/"]];
NSString *s1 = [[[NSString alloc]
initWithData:d encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"s1:%@", s1);と、次のコード
NSString *s2 =
[NSString stringWithContentsOfURL:
[NSURL URLWithString:@ "http://www.yahoo.co.jp/"]
encoding:NSUTF8StringEncoding error:&error];
NSLog(@"s2:%@", s2);は同じ結果になることを期待していたのですが、NSLog(@"s1:%@", s1);は(nil)となります。同じコードをLeopardで実行すると正しく動作します。ん〜、なんでだろ?
Tiger環境が自由に使えないため詳細を追い切れていません。というわけで、clippy for Tigerのaliasにhttp://〜を使うとうまくありません。(ローカルのfile:///〜はOK。ここがまたわからない...)
| 添付 | サイズ |
|---|---|
| URLTests.m | 610 bytes |
この記事のトラックバックURL:
http://hippos-lab.com/blog/trackback/306









Comments