文字列からURLを作成する - iOS開発メモ

サンプル

URLWithString:を使います。

NSURL *url = [NSURL URLWithString:@"http://www.example.com/index.html"];

NSLog(@"%@", url.scheme); // http
NSLog(@"%@", url.host); // www.example.com
NSLog(@"%@", url.path); // /index.html

関連項目