stringWithContentsOfURL:
URLで読み込んでNSStringを作って返します
+(id)stringWithContentsOfURL:(NSURL *)sender
解説
■10.4以降非推奨。
(stringWithContentsOfURL:encoding:error: または stringWithContentsOfURL:usedEncoding:error: を使います。)
URLで読み込んでNSStringを作って返します。
内容がU+FEFFまたはU+FFFEから始まるなら、内容をユニコード文字列だと解釈します。
そうでなければ、C文字列エンコーディングで文字を解釈します。
ファイルを開くことができなければnilを返します。
返り値
( id )
文字列(NSStringまたはそのサブクラス)
引数
( NSURL * )sender
読み込むURL
フレームワーク
Foundation
クラス
NSString
Class Methods
使用可能
10.0
参照
- initWithContentsOfURL:
+ defaultCStringEncoding
例文
NSURL *url = [NSURL URLWithString:@"http://www.oomori.com/"];
[name setStringValue:[NSString stringWithContentsOfURL:url]];