propertyForKey:
キーでレシーバのプロパティを返します
-(id)propertyForKey:(NSString *)propertyKey:
解説
キーでレシーバのプロパティを返します。
なければnilを返します。
【propertyKey】
● NSHTTPPropertyStatusCodeKey ステータスのコード OKなら200番台、エラーなら400番台
● NSHTTPPropertyStatusReasonKey ステータスの文字 "OK"や"Not Found"など
● NSHTTPPropertyServerHTTPVersionKey HTTPバージョン
● NSHTTPPropertyRedirectionHeadersKey
● NSHTTPPropertyErrorPageDataKey エラーページデータ
この下は10.2以降
● NSHTTPPropertyHTTPProxy
返り値
( id )
オブジェクト
引数
( NSString * )propertyKey
キー
フレームワーク
Foundation
クラス
NSURL
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSURL *url = [NSURL URLWithString:@"http://www.oomori.com/"]; NSLog( [[url propertyForKey:NSHTTPPropertyStatusCodeKey] description] ); NSLog( [[url propertyForKey:NSHTTPPropertyStatusReasonKey] description] ); NSLog( [[url propertyForKey:NSHTTPPropertyServerHTTPVersionKey] description] ); NSLog( [[url propertyForKey:NSHTTPPropertyRedirectionHeadersKey] description] ); NSLog( [[url propertyForKey:NSHTTPPropertyErrorPageDataKey] description] ); #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED NSLog( [[url propertyForKey:NSHTTPPropertyHTTPProxy] description] ); #endif } @end